aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Benjamin Jones <bjones@galois.com>2013-06-13 16:41:00 -0700
committerGravatar Benjamin Jones <bjones@galois.com>2013-06-13 16:41:00 -0700
commit4911edec15a73f0bbdaa1410d8d6422020212a47 (patch)
tree59a363f0414dbb006aad0e7fc3a8f5ae2277243a /src
parent8a13e1c62dacbc03e251ac7c41c09d7dee2df33d (diff)
added hack to fiveui.color.colorToRGB to return white on input rgba(0, 0, 0, 0)
Diffstat (limited to 'src')
-rw-r--r--src/js/fiveui/injected/prelude.js14
1 files changed, 10 insertions, 4 deletions
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]) };
+ }
};
/**