From 4911edec15a73f0bbdaa1410d8d6422020212a47 Mon Sep 17 00:00:00 2001 From: Benjamin Jones Date: Thu, 13 Jun 2013 16:41:00 -0700 Subject: added hack to fiveui.color.colorToRGB to return white on input rgba(0, 0, 0, 0) --- src/js/fiveui/injected/prelude.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/js/fiveui/injected/prelude.js b/src/js/fiveui/injected/prelude.js index ce27bdb..161682f 100644 --- a/src/js/fiveui/injected/prelude.js +++ b/src/js/fiveui/injected/prelude.js @@ -329,14 +329,20 @@ fiveui.color.colorToRGB = function(color) { return fiveui.color.hexToRGB(fiveui.color.colorToHex(color)); } - var digits = /rgba?\((\d+), (\d+), (\d+)/.exec(color); + var digits = /rgba?\((\d+), (\d+), (\d+)(, (\d+))?/.exec(color); if (!digits) { throw new ParseError('could not parse color string: ' + color); } - return { r: parseInt(digits[1]), - g: parseInt(digits[2]), - b: parseInt(digits[3]) }; + // HACK: return white if transparency is set to 0 + if (digits[5] == 0) { + return { r: 255, g: 255, b: 255 }; + } + else { + return { r: parseInt(digits[1]), + g: parseInt(digits[2]), + b: parseInt(digits[3]) }; + } }; /** -- cgit v1.2.3