diff options
Diffstat (limited to 'public/js/color.js')
| -rw-r--r-- | public/js/color.js | 9 |
1 files changed, 9 insertions, 0 deletions
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 ]), |
