This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

matchPalette

Adjust palette to match provided colors

layer.matchPalette(palette);

palette is an array of colors.

There are some default palettes:

var layer = cq(image);

layer.matchPalette(cq.palettes.db16);
layer.matchPalette(cq.palettes.db32);
layer.matchPalette(cq.palettes.gameboy);
layer.matchPalette(cq.palettes.c64);
layer.matchPalette(cq.palettes.cga);
layer.matchPalette(cq.palettes.nes);
layer.matchPalette(cq.palettes.sega);

author: twitter/daandruff

Gameboy

var layer = cq(400, 200).clear("#020").appendTo(document.body);

loadImages("ship", function(images) {

  layer.drawImage(images.ship, 0, 0);

  var GAMEBOY_PALETTE = ["#0f380f", "#306230", "#8bac0f", "#9bbc0f"];
  var gameboy = cq(images.ship).matchPalette(GAMEBOY_PALETTE);

  layer.drawImage(gameboy.canvas, 120, 0);

});


Have any questions? Don't hesitate to ask:

Post issues on github, support my work on gratipay author rezoner