Permalink
Browse files

display palette

  • Loading branch information...
1 parent eaf46ab commit e25141d10516e75cf7c25eb357551d2cc79d26bd @tj committed Dec 18, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 test
View
12 test
@@ -29,8 +29,18 @@ img.onload = function(){
img.src = path;
function paintPalette() {
+ var x = 0;
var colors = palette(canvas);
- console.log(colors);
+ colors.forEach(function(color){
+ var r = color[0]
+ , g = color[1]
+ , b = color[2]
+ , val = r << 16 | g << 8 | b
+ , str = '#' + val.toString(16);
+
+ ctx.fillStyle = str;
+ ctx.fillRect(x += 31, canvas.height - 40, 30, 30);
+ });
}
function save() {

0 comments on commit e25141d

Please sign in to comment.