GithubHelp home page GithubHelp logo

marijnvdwerf / material-palette Goto Github PK

View Code? Open in Web Editor NEW
128.0 4.0 4.0 599 KB

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

Home Page: http://marijnvdwerf.github.io/material-palette

License: Apache License 2.0

JavaScript 100.00%

material-palette's Introduction

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

material-palette's People

Contributors

marijnvdwerf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

material-palette's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.