Quantize.js is a tiny (10.1 kB minified) color quantization library. It extracts approximate color palletes from an input image using a variety of different methods.
It's similar to Color Thief, but twice as fast in Chrome with multiple quantization methods supported.
In addition to the following examples, the source code is clean and documented with Docco. It can be found here.
var image = document.getElementById("inputImage");
var quantize = new Quantize();
var color = quantize.getColor(image);
// color = [R, G, B];
var image = document.getElementById("inputImage");
var quantize = new Quantize();
var colors = quantize.getPalette(image, 8);
// color = [[R, G, B], [R, G, B], ...];
Note: The array is ordered by the prominance of the color.