From 4a3ca2136e33651c0eaddcbef1fb2aed7fd1161c Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 20:09:48 -0400 Subject: [PATCH 01/18] Update tinycolor.js --- tinycolor.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tinycolor.js b/tinycolor.js index 9580299..8762249 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -124,6 +124,12 @@ tinycolor.prototype = { toHex8String: function(allow4Char) { return '#' + this.toHex8(allow4Char); }, + toHex8Argb: function(allow4Char) { + return rgbaToArgbHex(this._r, this._g, this._b,this._a); + }, + toHex8ArgbString: function(allow4Char) { + return '#' + this.toHex8Argb(allow4Char); + }, toRgb: function() { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, From 245e9978748b7542e77b60949e3b12ae7a0dff21 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 22:57:18 -0400 Subject: [PATCH 02/18] Update tinycolor.js --- tinycolor.js | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 2 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index 9580299..069fc66 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -1,4 +1,4 @@ -// TinyColor v1.4.1 +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -17,6 +17,8 @@ function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; + console.log(opts); + // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; @@ -25,8 +27,29 @@ function tinycolor (color, opts) { if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } + // this will fix old browsers + if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function(value) { + for (var i = 0; i < this.length; i++) { + if (this[i] === value) { + return i; + } + } - var rgb = inputToRGB(color); + return -1; + } + } + + var rgb; + + if(opts.hex8Argb){ + console.log(true); + rgb = stringHexArgbInputToObject(color); + } else { + console.log(false); + rgb = inputToRGB(color); + } + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, @@ -124,6 +147,12 @@ tinycolor.prototype = { toHex8String: function(allow4Char) { return '#' + this.toHex8(allow4Char); }, + toHex8Argb: function(allow4Char) { + return rgbaToArgbHex(this._r, this._g, this._b,this._a); + }, + toHex8ArgbString: function(allow4Char) { + return '#' + this.toHex8Argb(allow4Char); + }, toRgb: function() { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, @@ -1163,6 +1192,54 @@ function stringInputToObject(color) { return false; } +// `stringHexArgbInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +function stringHexArgbInputToObject(color) { + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if ((match = matchers.hex8.exec(color))) { + return { + r: parseIntFromHex(match[2]), + g: parseIntFromHex(match[3]), + b: parseIntFromHex(match[4]), + a: convertHexToDecimal(match[1]), + format: "hex8" + }; + } + if ((match = matchers.hex6.exec(color))) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: "hex" + }; + } + if ((match = matchers.hex4.exec(color))) { + return { + r: parseIntFromHex(match[2] + '' + match[1]), + g: parseIntFromHex(match[3] + '' + match[2]), + b: parseIntFromHex(match[4] + '' + match[3]), + a: convertHexToDecimal(match[1] + '' + match[4]), + format: "hex8" + }; + } + if ((match = matchers.hex3.exec(color))) { + return { + r: parseIntFromHex(match[1] + '' + match[1]), + g: parseIntFromHex(match[2] + '' + match[2]), + b: parseIntFromHex(match[3] + '' + match[3]), + format: named ? "name" : "hex" + }; + } + + return false; +} + function validateWCAG2Parms(parms) { // return valid WCAG2 parms for isReadable. // If input parms are invalid, return {"level":"AA", "size":"small"} From 54eb28f5b6ff9b575f29f8e4d3588ae4699ebf85 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 22:58:56 -0400 Subject: [PATCH 03/18] adding input option toggle for hex8Argb --- tinycolor.js | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index 8762249..069fc66 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -1,4 +1,4 @@ -// TinyColor v1.4.1 +// TinyColor v1.4.2 // https://github.com/bgrins/TinyColor // Brian Grinstead, MIT License @@ -17,6 +17,8 @@ function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; + console.log(opts); + // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; @@ -25,8 +27,29 @@ function tinycolor (color, opts) { if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } + // this will fix old browsers + if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function(value) { + for (var i = 0; i < this.length; i++) { + if (this[i] === value) { + return i; + } + } - var rgb = inputToRGB(color); + return -1; + } + } + + var rgb; + + if(opts.hex8Argb){ + console.log(true); + rgb = stringHexArgbInputToObject(color); + } else { + console.log(false); + rgb = inputToRGB(color); + } + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, @@ -1169,6 +1192,54 @@ function stringInputToObject(color) { return false; } +// `stringHexArgbInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +function stringHexArgbInputToObject(color) { + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if ((match = matchers.hex8.exec(color))) { + return { + r: parseIntFromHex(match[2]), + g: parseIntFromHex(match[3]), + b: parseIntFromHex(match[4]), + a: convertHexToDecimal(match[1]), + format: "hex8" + }; + } + if ((match = matchers.hex6.exec(color))) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: "hex" + }; + } + if ((match = matchers.hex4.exec(color))) { + return { + r: parseIntFromHex(match[2] + '' + match[1]), + g: parseIntFromHex(match[3] + '' + match[2]), + b: parseIntFromHex(match[4] + '' + match[3]), + a: convertHexToDecimal(match[1] + '' + match[4]), + format: "hex8" + }; + } + if ((match = matchers.hex3.exec(color))) { + return { + r: parseIntFromHex(match[1] + '' + match[1]), + g: parseIntFromHex(match[2] + '' + match[2]), + b: parseIntFromHex(match[3] + '' + match[3]), + format: named ? "name" : "hex" + }; + } + + return false; +} + function validateWCAG2Parms(parms) { // return valid WCAG2 parms for isReadable. // If input parms are invalid, return {"level":"AA", "size":"small"} From dd6292570e45fcdd6ea5fd6616e452f5cdd29244 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 23:00:05 -0400 Subject: [PATCH 04/18] remove logs --- tinycolor.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index 069fc66..91d4ba2 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -17,8 +17,6 @@ function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; - console.log(opts); - // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; @@ -43,10 +41,8 @@ function tinycolor (color, opts) { var rgb; if(opts.hex8Argb){ - console.log(true); rgb = stringHexArgbInputToObject(color); } else { - console.log(false); rgb = inputToRGB(color); } From 02ec0353af67423199f70385b2626b9b6801ac24 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 23:34:22 -0400 Subject: [PATCH 05/18] fixing actual code insert --- tinycolor.js | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index 069fc66..b95b4e7 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -17,8 +17,6 @@ function tinycolor (color, opts) { color = (color) ? color : ''; opts = opts || { }; - console.log(opts); - // If input is already a tinycolor, return itself if (color instanceof tinycolor) { return color; @@ -27,26 +25,11 @@ function tinycolor (color, opts) { if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } - // this will fix old browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function(value) { - for (var i = 0; i < this.length; i++) { - if (this[i] === value) { - return i; - } - } - - return -1; - } - } - var rgb; if(opts.hex8Argb){ - console.log(true); rgb = stringHexArgbInputToObject(color); } else { - console.log(false); rgb = inputToRGB(color); } From 190029d92781178b90cf98dba8ba19c2e77909d2 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sat, 20 Oct 2018 23:36:03 -0400 Subject: [PATCH 06/18] removing accidental code insertion --- tinycolor.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index 91d4ba2..b95b4e7 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -25,19 +25,6 @@ function tinycolor (color, opts) { if (!(this instanceof tinycolor)) { return new tinycolor(color, opts); } - // this will fix old browsers - if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function(value) { - for (var i = 0; i < this.length; i++) { - if (this[i] === value) { - return i; - } - } - - return -1; - } - } - var rgb; if(opts.hex8Argb){ From 755a1462d04a6641d8fcf5ea1b12af98fa104603 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 21 Oct 2018 04:36:14 -0400 Subject: [PATCH 07/18] Update README.md --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 165777a..a63230f 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,20 @@ Here are some examples of string input: ```js tinycolor("#000"); tinycolor("000"); -tinycolor("#369C"); +tinycolor("#"); tinycolor("369C"); tinycolor("#f0f0f6"); tinycolor("f0f0f6"); tinycolor("#f0f0f688"); tinycolor("f0f0f688"); ``` +### Hex (Argb), 8-digit (ARGB) Hex +```js +tinycolor("#C369", {"hex8Argb":true}); +tinycolor("C369", {"hex8Argb":true}); +tinycolor("#88f0f0f6", {"hex8Argb":true}); +tinycolor("88f0f0f6", {"hex8Argb":true}); +``` ### RGB, RGBA ```js tinycolor("rgb (255, 0, 0)"); @@ -246,6 +253,16 @@ color.toHex8(); // "ff0000ff" var color = tinycolor("red"); color.toHex8String(); // "#ff0000ff" ``` +### toHex8Argb +```js +var color = tinycolor("red"); +color.toHex8Argb(); // "ffff0000" +``` +### toHex8ArgbString +```js +var color = tinycolor("red"); +color.toHex8ArgbString(); // "#ffff0000" +``` ### toRgb ```js var color = tinycolor("red"); From 9ba76691a41abc02781a2384ba798d63ca065682 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 21 Oct 2018 05:15:21 -0400 Subject: [PATCH 08/18] making link relative --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a63230f..461a211 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ TinyColor is a small, fast library for color manipulation and conversion in Java [![Build Status](https://travis-ci.org/bgrins/TinyColor.png?branch=master)](https://travis-ci.org/bgrins/TinyColor) ## Including in a browser - -Download [tinycolor.js](https://raw.githubusercontent.com/bgrins/TinyColor/master/tinycolor.js) or install it with bower: +https://github.com/CrandellWS/TinyColor/ +Download [tinycolor.js](tinycolor.js?raw=true) or install it with bower: bower install tinycolor From 6a154925e16f8197a701903a32d00768caafc79c Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 21 Oct 2018 05:15:45 -0400 Subject: [PATCH 09/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 461a211..71326a7 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ TinyColor is a small, fast library for color manipulation and conversion in Java [![Build Status](https://travis-ci.org/bgrins/TinyColor.png?branch=master)](https://travis-ci.org/bgrins/TinyColor) ## Including in a browser -https://github.com/CrandellWS/TinyColor/ + Download [tinycolor.js](tinycolor.js?raw=true) or install it with bower: bower install tinycolor From 48852d99388f20126183bb191814314eca8a8fd9 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 21 Oct 2018 05:22:59 -0400 Subject: [PATCH 10/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 71326a7..4c260a1 100644 --- a/README.md +++ b/README.md @@ -468,7 +468,7 @@ tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).to tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString() // "#2e0c3a", tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString() // "#000000", ``` -See [index.html](https://github.com/bgrins/TinyColor/blob/master/index.html) in the project for a demo. +See [index.html](index.html) in the project for a demo. ## Common operations From 700939a6711adfae3d7ba6e81573cbe9e751c12b Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 05:42:05 -0500 Subject: [PATCH 11/18] rgb alpha NaN fix --- tinycolor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycolor.js b/tinycolor.js index b95b4e7..24f2ac2 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -140,7 +140,7 @@ tinycolor.prototype = { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, toRgbString: function() { - return (this._a == 1) ? + return (typeof this._a === "undefined" || this._a == 1) ? "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; }, From 492439719ea1cd63579162e5dd627deefc615039 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 05:44:45 -0500 Subject: [PATCH 12/18] hex to rgb fix alpha NAN --- tinycolor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycolor.js b/tinycolor.js index b95b4e7..24f2ac2 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -140,7 +140,7 @@ tinycolor.prototype = { return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; }, toRgbString: function() { - return (this._a == 1) ? + return (typeof this._a === "undefined" || this._a == 1) ? "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; }, From 4661a6960c21726d069771f81f8417410cd088b7 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 05:56:28 -0500 Subject: [PATCH 13/18] added toRgbaString: function fixes #144 --- tinycolor.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tinycolor.js b/tinycolor.js index 24f2ac2..3d5e49a 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -144,6 +144,11 @@ tinycolor.prototype = { "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; }, + toRgbaString: function() { + return (typeof this._a === "undefined" || this._a == 1) ? + "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", 1)" : + "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; + }, toPercentageRgb: function() { return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; }, From 0a484394e3878eb2cd63431654cc2a0c7a1571b5 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 06:21:42 -0500 Subject: [PATCH 14/18] more accurate alpha --- tinycolor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycolor.js b/tinycolor.js index 3d5e49a..faf561e 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -38,7 +38,7 @@ function tinycolor (color, opts) { this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, + this._roundA = mathRound(1000*this._a) / 1000, this._format = opts.format || rgb.format; this._gradientType = opts.gradientType; From 1f81abd0be9e8632e230bec34280037da264146f Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 06:24:00 -0500 Subject: [PATCH 15/18] more accurate alpha --- tinycolor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycolor.js b/tinycolor.js index faf561e..9603158 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -93,7 +93,7 @@ tinycolor.prototype = { }, setAlpha: function(value) { this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; + this._roundA = mathRound(1000*this._a) / 1000; return this; }, toHsv: function() { From d87c6cd29062ce3f2a3d41e23a61be7f6917a602 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Sun, 4 Nov 2018 13:43:48 -0500 Subject: [PATCH 16/18] Added Argb() output String This is work to fix #192 This adds toArgbString() output function. This does not provide a correlated input flag...yet --- tinycolor.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tinycolor.js b/tinycolor.js index 9603158..feeac65 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -96,6 +96,11 @@ tinycolor.prototype = { this._roundA = mathRound(1000*this._a) / 1000; return this; }, + toArgbString: function() { + return (typeof this._a === "undefined" || this._a == 1) ? + "argb(1, " + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : + "argb(" + parseIntFromHex(convertDecimalToHex(this._a)) + ", " + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")"; + }, toHsv: function() { var hsv = rgbToHsv(this._r, this._g, this._b); return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; From c8187a7a6ad1b3fd3f292c558c164eaf1bc53f18 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Mon, 5 Nov 2018 10:45:03 -0500 Subject: [PATCH 17/18] adding ARGB input checking if argb first to prevent it being identified as rbg ... as it would give current regex... --- tinycolor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tinycolor.js b/tinycolor.js index feeac65..35732e0 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -33,6 +33,8 @@ function tinycolor (color, opts) { rgb = inputToRGB(color); } + + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, @@ -375,8 +377,8 @@ function inputToRGB(color) { a: a }; } - - + + // Conversion Functions // -------------------- @@ -1089,6 +1091,7 @@ var matchers = (function() { return { CSS_UNIT: new RegExp(CSS_UNIT), + argb: new RegExp("argb" + PERMISSIVE_MATCH4), rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), @@ -1129,6 +1132,9 @@ function stringInputToObject(color) { // Just return an object and let the conversion functions handle that. // This way the result will be the same whether the tinycolor is initialized with string or object. var match; + if ((match = matchers.argb.exec(color))) { + return { a: match[1], r: match[2], g: match[3], b: match[4] }; + } if ((match = matchers.rgb.exec(color))) { return { r: match[1], g: match[2], b: match[3] }; } From 1a6d1ae6b52c39ccc79922c491d1e37bc0db4811 Mon Sep 17 00:00:00 2001 From: William Crandell Date: Mon, 5 Nov 2018 14:31:43 -0500 Subject: [PATCH 18/18] argb alpha input set as range 255 --- tinycolor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tinycolor.js b/tinycolor.js index 35732e0..4f2c9d8 100644 --- a/tinycolor.js +++ b/tinycolor.js @@ -1133,7 +1133,7 @@ function stringInputToObject(color) { // This way the result will be the same whether the tinycolor is initialized with string or object. var match; if ((match = matchers.argb.exec(color))) { - return { a: match[1], r: match[2], g: match[3], b: match[4] }; + return { a: (match[1] / 255), r: match[2], g: match[3], b: match[4] }; } if ((match = matchers.rgb.exec(color))) { return { r: match[1], g: match[2], b: match[3] };