Diffstat (limited to 'frontend/gamma/js/MochiKit/Color.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/MochiKit/Color.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/frontend/gamma/js/MochiKit/Color.js b/frontend/gamma/js/MochiKit/Color.js index 27dc2d0..f2a0f67 100644 --- a/frontend/gamma/js/MochiKit/Color.js +++ b/frontend/gamma/js/MochiKit/Color.js | |||
@@ -5,13 +5,13 @@ MochiKit.Color 1.5 | |||
5 | See <http://mochikit.com/> for documentation, downloads, license, etc. | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
6 | 6 | ||
7 | (c) 2005 Bob Ippolito and others. All rights Reserved. | 7 | (c) 2005 Bob Ippolito and others. All rights Reserved. |
8 | 8 | ||
9 | ***/ | 9 | ***/ |
10 | 10 | ||
11 | MochiKit.Base._module('Color', '1.5', ['Base', 'DOM', 'Style']); | 11 | MochiKit.Base.module(MochiKit, 'Color', '1.5', ['Base', 'DOM', 'Style']); |
12 | 12 | ||
13 | /** @id MochiKit.Color.Color */ | 13 | /** @id MochiKit.Color.Color */ |
14 | MochiKit.Color.Color = function (red, green, blue, alpha) { | 14 | MochiKit.Color.Color = function (red, green, blue, alpha) { |
15 | if (typeof(alpha) == 'undefined' || alpha === null) { | 15 | if (typeof(alpha) == 'undefined' || alpha === null) { |
16 | alpha = 1.0; | 16 | alpha = 1.0; |
17 | } | 17 | } |
@@ -109,13 +109,13 @@ MochiKit.Color.Color.prototype = { | |||
109 | [b.r, b.g, b.b, b.a] | 109 | [b.r, b.g, b.b, b.a] |
110 | ); | 110 | ); |
111 | }, | 111 | }, |
112 | 112 | ||
113 | /** @id MochiKit.Color.Color.prototype.isLight */ | 113 | /** @id MochiKit.Color.Color.prototype.isLight */ |
114 | isLight: function () { | 114 | isLight: function () { |
115 | return this.asHSL().b > 0.5; | 115 | return this.asHSL().l > 0.5; |
116 | }, | 116 | }, |
117 | 117 | ||
118 | /** @id MochiKit.Color.Color.prototype.isDark */ | 118 | /** @id MochiKit.Color.Color.prototype.isDark */ |
119 | isDark: function () { | 119 | isDark: function () { |
120 | return (!this.isLight()); | 120 | return (!this.isLight()); |
121 | }, | 121 | }, |
@@ -638,25 +638,16 @@ MochiKit.Base.update(MochiKit.Color, { | |||
638 | /** @id MochiKit.Color.whiteColor */ | 638 | /** @id MochiKit.Color.whiteColor */ |
639 | white: [1, 1, 1], | 639 | white: [1, 1, 1], |
640 | /** @id MochiKit.Color.yellowColor */ | 640 | /** @id MochiKit.Color.yellowColor */ |
641 | yellow: [1, 1, 0] | 641 | yellow: [1, 1, 0] |
642 | }; | 642 | }; |
643 | 643 | ||
644 | var makeColor = function (name, r, g, b, a) { | ||
645 | var rval = this.fromRGB(r, g, b, a); | ||
646 | this[name] = function () { return rval; }; | ||
647 | return rval; | ||
648 | }; | ||
649 | |||
650 | for (var k in colors) { | 644 | for (var k in colors) { |
651 | var name = k + "Color"; | 645 | var name = k + "Color"; |
652 | var bindArgs = m.concat( | 646 | var value = this.Color.fromRGB.apply(this.Color, colors[k]); |
653 | [makeColor, this.Color, name], | 647 | this.Color[name] = m.partial(m.operator.identity, value); |
654 | colors[k] | ||
655 | ); | ||
656 | this.Color[name] = m.bind.apply(null, bindArgs); | ||
657 | } | 648 | } |
658 | 649 | ||
659 | var isColor = function () { | 650 | var isColor = function () { |
660 | for (var i = 0; i < arguments.length; i++) { | 651 | for (var i = 0; i < arguments.length; i++) { |
661 | if (!(arguments[i] instanceof MochiKit.Color.Color)) { | 652 | if (!(arguments[i] instanceof MochiKit.Color.Color)) { |
662 | return false; | 653 | return false; |