Permalink
Browse files

Put the named color map in a variable (saves 37 bytes).

  • Loading branch information...
1 parent b991fcc commit 4371f83dfd04d01ef40e65c7bb062a03a0bb2110 @papandreou papandreou committed Mar 2, 2012
Showing with 7 additions and 7 deletions.
  1. +2 −1 lib/color-namedColors.js
  2. +4 −5 lib/color.js
  3. +1 −1 lib/color/_all.js
View
@@ -1,4 +1,5 @@
-ONECOLOR.namedColors = {
+/*global namedColors*/
+namedColors = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
View
@@ -1,4 +1,5 @@
var installedColorSpaces = [],
+ namedColors = {},
channelRegExp = /\s*(\.\d+|\d+(?:\.\d+)?)(%)?\s*/,
alphaChannelRegExp = /\s*(\.\d+|\d+(?:\.\d+)?)\s*/,
cssColorRegExp = new RegExp(
@@ -20,11 +21,9 @@ function ONECOLOR (obj) {
return new ONECOLOR[obj[0]](obj.slice(1, obj.length));
}
} else if (obj.charCodeAt) {
- if (ONECOLOR.namedColors) {
- var lowerCased = obj.toLowerCase();
- if (ONECOLOR.namedColors[lowerCased]) {
- obj = ONECOLOR.namedColors[lowerCased];
- }
+ var lowerCased = obj.toLowerCase();
+ if (namedColors[lowerCased]) {
+ obj = namedColors[lowerCased];
}
// Test for CSS rgb(....) string
var matchCssSyntax = obj.match(cssColorRegExp);
View
@@ -2,10 +2,10 @@
// This file is purely for the build system
one.include('lib:color.js');
+one.include('lib:color-namedColors.js');
one.include('lib:color/HSV.js');
one.include('lib:color/HSL.js');
one.include('lib:color/CMYK.js');
-one.include('lib:color-namedColors.js');
// Convenience functions
one.include('lib:color/plugins/clearer.js');

0 comments on commit 4371f83

Please sign in to comment.