Skip to content

Navigation Menu

Sign in
Sign up

Latest commit

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

RGBaster

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

Usage

Usage is simple. Create an image (or grab an image URL), then get its dominant color & palette.

var img = document.getElementById('image');
// or
var img = 'http://example.com/path-to-image.jpg'
RGBaster.colors(img, {
 success: function(payload) {
 // You now have the payload.
 console.log(payload.dominant);
 console.log(payload.secondary);
 console.log(payload.palette);
 }
});

The colors function takes an optional second parameter, which are its options:

RGBaster.colors(img, {
 paletteSize: 30,
 exclude: [ 'rgb(255,255,255)' ], // don't count white
 success: function(payload){
 // do something with payload
 }
})

Browser support

rgbaster.js depends on the following browser functionality:

Check the linked resources above to determine current level of browser support.

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

About

A simple library for extracting dominant colors from images.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /