Need help with material-palette?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

marijnvdwerf
127 Stars 4 Forks Apache License 2.0 14 Commits 1 Opened issues

Description

Colour extraction library, based on the [Palette support library](http://chris.banes.me/2014/07/04/palette-preview/) by @chrisbanes

Services available

!
?

Need anything else?

Contributors list

No Data

Demonstration

Demonstration The top row consists of the colors generated by the original library, the bottom row is generated by this JavaScript version.

Usage

var header = $('.header');
var avatar = header.find('img.avatar');
Palette
    .generate(avatar)
    .done(function(palette) {
        var vibrantColor = palette.getVibrantColor();
        if(vibrantColor !== null) {
            header.css('color', vibrantColor.toString());
        }
    }, function(error) {
        console.error(error);
    }
});

Issues

There are (about) three reasons this library doesn't completely match the Java version - Images are scaled differently and colors might appear in different quantities - The RGB to HSL conversion is different, and the code might behave differently in edge cases (i.e. a float on Android might be just above 1.0, while in JS it's cut off at 1) - The PriorityQueues on both platforms behave differently. I translated most of the Java code, yet objects still don't get sorted the same 100% of the time. Any help on this would be greatly appreciated.

Acknowledgements

  • Chris Banes, author of the original Java-based library

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.