|
|
@ -28,8 +28,8 @@
|
|
|
|
grey = {r: 0.298954, g: 0.586434, b: 0.114612}, // CIE-XYZ 1931
|
|
|
|
grey = {r: 0.298954, g: 0.586434, b: 0.114612}, // CIE-XYZ 1931
|
|
|
|
luminance = {r: 0.2126, g: 0.7152, b: 0.0722}, // W3C 2.0
|
|
|
|
luminance = {r: 0.2126, g: 0.7152, b: 0.0722}, // W3C 2.0
|
|
|
|
|
|
|
|
|
|
|
|
_math = Math,
|
|
|
|
_math = window.Math,
|
|
|
|
_parseint = parseInt,
|
|
|
|
_parseint = window.parseInt,
|
|
|
|
|
|
|
|
|
|
|
|
Colors = window.Colors = function(options) {
|
|
|
|
Colors = window.Colors = function(options) {
|
|
|
|
this.colors = {RND: {}};
|
|
|
|
this.colors = {RND: {}};
|
|
|
@ -146,7 +146,7 @@
|
|
|
|
convert[fromType + '2' + toType] ? convert[fromType + '2' + toType](color, true) : // existing converter
|
|
|
|
convert[fromType + '2' + toType] ? convert[fromType + '2' + toType](color, true) : // existing converter
|
|
|
|
toType === 'HEX' ? convert.RGB2HEX(type === 'RGB2HEX' ? color : normalize(fromType === 'rgb' ? color :
|
|
|
|
toType === 'HEX' ? convert.RGB2HEX(type === 'RGB2HEX' ? color : normalize(fromType === 'rgb' ? color :
|
|
|
|
convert[fromType + '2rgb'](color, true), 'rgb', true)) :
|
|
|
|
convert[fromType + '2rgb'](color, true), 'rgb', true)) :
|
|
|
|
convert['rgb2' + toType](convert[fromType + '2rgb'](color, true), true) // not in ColorConverter
|
|
|
|
convert['rgb2' + toType](convert[fromType + '2rgb'](color, true), true) // not in ColorConverter
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (normalizeTo) { // from abc to ABC
|
|
|
|
if (normalizeTo) { // from abc to ABC
|
|
|
|
color = normalize(color, toType, true);
|
|
|
|
color = normalize(color, toType, true);
|
|
|
@ -167,7 +167,8 @@
|
|
|
|
alpha = alpha !== undefined ? alpha : color.alpha;
|
|
|
|
alpha = alpha !== undefined ? alpha : color.alpha;
|
|
|
|
} else if (color) {
|
|
|
|
} else if (color) {
|
|
|
|
for (var n in color) {
|
|
|
|
for (var n in color) {
|
|
|
|
colors[type][n] = limitValue(color[n] / _valueRanges[type][n][1], 0 , 1);
|
|
|
|
colors[type][n] = type === 'Lab' ? color[n] :
|
|
|
|
|
|
|
|
limitValue(color[n] / _valueRanges[type][n][1], 0 , 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (alpha !== undefined) {
|
|
|
|
if (alpha !== undefined) {
|
|
|
|