Skip to content

Commit 9c077e3

Browse files
treehousetimsimonbrunel
authored andcommitted
Parsing RGB(A) strings is now case insensitive (#1)
1 parent 6cde16d commit 9c077e3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

color-string.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ function getRgba(string) {
2424
if (!string) {
2525
return;
2626
}
27-
var abbr = /^#([a-fA-F0-9]{3})$/,
28-
hex = /^#([a-fA-F0-9]{6})$/,
29-
rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,
30-
per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,
27+
var abbr = /^#([a-fA-F0-9]{3})$/i,
28+
hex = /^#([a-fA-F0-9]{6})$/i,
29+
rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
30+
per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
3131
keyword = /(\w+)/;
3232

3333
var rgb = [0, 0, 0],

0 commit comments

Comments
 (0)