A javascript implementation of the Palette class from the Android Support Library
npm install img-palette
There is a demo available here with the source here.
var Palette = require('img-palette');
var colors = new Palette(document.findElementById('image'));