From 4dfa8d9dc602e11bf335d289ae7717f408403ca0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 3 Mar 2013 18:04:09 -0500 Subject: mask and colorize superpaint patterns --- public/js/color.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public/js/color.js') diff --git a/public/js/color.js b/public/js/color.js index 85fe95d..579ed5e 100644 --- a/public/js/color.js +++ b/public/js/color.js @@ -31,6 +31,15 @@ Color.prototype.alpha = function(a){ c.a = a; return c; } +Color.prototype.swatch = function(){ + var el = document.createElement("div"); + el.style.className = "swatch"; + el.style.width = 16 + "px"; + el.style.height = 16 + "px"; + el.style.backgroundColor = this.toString(); + $(el).data("color", this); + return el; +} var colors = { red: new Color([ 255,0,0 ]), -- cgit v1.2.3-70-g09d2