/rgbaster.js

A simple library for extracting dominant colors from images.

Primary LanguageJavaScript

RGBaster

A dead simple javascript library for extracting the dominant color from an image.

Usage

Usage is simple. Create an image, then get its dominant color & palette.

var img = document.getElementById('image');
var colors = RGBaster.colors(img, function(payload){
  // You now have the payload.
  console.log(payload.dominant);
  console.log(payload.palette);
});

The colors function takes an optional third parameter, which is the size of the palette to return. By default, it returns a palette size of 10.

var colors = RGBaster.colors(img, success, 30) // Returns 30 colors.

Author

twitter/brianmgonzalez
Brian Gonzalez

About

RGBaster was created to modularize a feature of another plugin I built called adaptive backgrounds. Check it out!

License

MIT