Permalink
Browse files

Lowercase the named color name before looking it up in the one.color.…

…namedColors map.
  • Loading branch information...
1 parent cd37673 commit 0b4e7e4a4a6b65dd558ab3a700c5280dd62f46ca @papandreou papandreou committed Feb 28, 2012
Showing with 17 additions and 8 deletions.
  1. +5 −2 lib/one/color.js
  2. +5 −2 one-color-all-debug.js
  3. +1 −1 one-color-all.js
  4. +5 −2 one-color-debug.js
  5. +1 −1 one-color.js
View
@@ -47,8 +47,11 @@ myColor = color(myColor);
return new ONECOLOR[obj[0]](obj.slice(1, obj.length));
}
} else if (obj.charCodeAt) {
- if (ONECOLOR.namedColors && ONECOLOR.namedColors[obj]) {
- obj = ONECOLOR.namedColors[obj];
+ if (ONECOLOR.namedColors) {
+ var lowerCased = obj.toLowerCase();
+ if (ONECOLOR.namedColors[lowerCased]) {
+ obj = ONECOLOR.namedColors[lowerCased];
+ }
}
// Test for CSS rgb(....) string
var matchCssSyntax = obj.match(cssColorRegExp);
View
@@ -59,8 +59,11 @@ myColor = color(myColor);
return new ONECOLOR[obj[0]](obj.slice(1, obj.length));
}
} else if (obj.charCodeAt) {
- if (ONECOLOR.namedColors && ONECOLOR.namedColors[obj]) {
- obj = ONECOLOR.namedColors[obj];
+ if (ONECOLOR.namedColors) {
+ var lowerCased = obj.toLowerCase();
+ if (ONECOLOR.namedColors[lowerCased]) {
+ obj = ONECOLOR.namedColors[lowerCased];
+ }
}
// Test for CSS rgb(....) string
var matchCssSyntax = obj.match(cssColorRegExp);
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -59,8 +59,11 @@ myColor = color(myColor);
return new ONECOLOR[obj[0]](obj.slice(1, obj.length));
}
} else if (obj.charCodeAt) {
- if (ONECOLOR.namedColors && ONECOLOR.namedColors[obj]) {
- obj = ONECOLOR.namedColors[obj];
+ if (ONECOLOR.namedColors) {
+ var lowerCased = obj.toLowerCase();
+ if (ONECOLOR.namedColors[lowerCased]) {
+ obj = ONECOLOR.namedColors[lowerCased];
+ }
}
// Test for CSS rgb(....) string
var matchCssSyntax = obj.match(cssColorRegExp);
Oops, something went wrong.

0 comments on commit 0b4e7e4

Please sign in to comment.