Skip to content

Commit f52303e

Browse files
committed
Fix 3 digit hex parsing, the G/B channels were swapped.
Reported by Elijah Insua in issue 1.
1 parent 507133f commit f52303e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

csscolorparser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ function parseCSSColor(css_str) {
141141
var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.
142142
if (!(iv >= 0 && iv <= 0xfff)) return null; // Covers NaN.
143143
return [((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),
144-
(iv & 0xf) | ((iv & 0xf) << 4),
145144
(iv & 0xf0) | ((iv & 0xf0) >> 4),
145+
(iv & 0xf) | ((iv & 0xf) << 4),
146146
1];
147147
} else if (str.length === 7) {
148148
var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.

0 commit comments

Comments
 (0)