Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-color

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-color - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

src/define.js

2

build/bundle.js

@@ -1,1 +0,1 @@

var version = "0.4.1"; export * from "../index"; export {version};
var version = "0.4.2"; export * from "../index"; export {version};
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.d3_color = {})));
(factory((global.d3_color = global.d3_color || {})));
}(this, function (exports) { 'use strict';
function define(constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
}
function Color() {}

@@ -171,3 +182,3 @@

color.prototype = Color.prototype = {
define(Color, color, {
displayable: function() {

@@ -179,3 +190,3 @@ return this.rgb().displayable();

}
};
});

@@ -225,34 +236,30 @@ function color(format) {

var _rgb = rgb.prototype = Rgb.prototype = new Color;
define(Rgb, rgb, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
},
toString: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
}
}));
_rgb.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
};
_rgb.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
};
_rgb.rgb = function() {
return this;
};
_rgb.displayable = function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
};
_rgb.toString = function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
};
function hsla(h, s, l, a) {

@@ -302,34 +309,31 @@ if (a <= 0) h = s = l = NaN;

var _hsl = hsl.prototype = Hsl.prototype = new Color;
define(Hsl, hsl, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
}
}));
_hsl.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
};
_hsl.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
};
_hsl.rgb = function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
};
_hsl.displayable = function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
};
/* From FvD 13.37, CSS Color Module Level 3 */

@@ -381,27 +385,25 @@ function hsl2rgb(h, m1, m2) {

var _lab = lab.prototype = Lab.prototype = new Color;
define(Lab, lab, extend(Color, {
brighter: function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
}
}));
_lab.brighter = function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
};
_lab.darker = function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
};
_lab.rgb = function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
};
function xyz2lab(t) {

@@ -441,16 +443,14 @@ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;

var _hcl = hcl.prototype = Hcl.prototype = new Color;
define(Hcl, hcl, extend(Color, {
brighter: function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return labConvert(this).rgb();
}
}));
_hcl.brighter = function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
};
_hcl.darker = function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
};
_hcl.rgb = function() {
return labConvert(this).rgb();
};
var A = -0.14861;

@@ -489,30 +489,28 @@ var B = +1.78277;

var _cubehelix = cubehelix.prototype = Cubehelix.prototype = new Color;
define(Cubehelix, cubehelix, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
}
}));
_cubehelix.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
};
var version = "0.4.2";
_cubehelix.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
};
_cubehelix.rgb = function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
};
var version = "0.4.1";
exports.version = version;

@@ -519,0 +517,0 @@ exports.color = color;

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.d3_color={})}(this,function(t){"use strict";function e(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=P.exec(t))?(e=parseInt(e[1],16),new o(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=j.exec(t))?i(parseInt(e[1],16)):(e=S.exec(t))?new o(e[1],e[2],e[3],1):(e=z.exec(t))?new o(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=C.exec(t))?r(e[1],e[2],e[3],e[4]):(e=L.exec(t))?r(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=O.exec(t))?h(e[1],e[2]/100,e[3]/100,1):(e=_.exec(t))?h(e[1],e[2]/100,e[3]/100,e[4]):A.hasOwnProperty(t)?i(A[t]):"transparent"===t?new o(NaN,NaN,NaN,0):null}function i(t){return new o(t>>16&255,t>>8&255,255&t,1)}function r(t,e,n,i){return 0>=i&&(t=e=n=NaN),new o(t,e,n,i)}function a(t){return t instanceof e||(t=n(t)),t?(t=t.rgb(),new o(t.r,t.g,t.b,t.opacity)):new o}function s(t,e,n,i){return 1===arguments.length?a(t):new o(t,e,n,null==i?1:i)}function o(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function h(t,e,n,i){return 0>=i?t=e=n=NaN:0>=n||n>=1?t=e=NaN:0>=e&&(t=NaN),new c(t,e,n,i)}function l(t){if(t instanceof c)return new c(t.h,t.s,t.l,t.opacity);if(t instanceof e||(t=n(t)),!t)return new c;if(t instanceof c)return t;t=t.rgb();var i=t.r/255,r=t.g/255,a=t.b/255,s=Math.min(i,r,a),o=Math.max(i,r,a),h=NaN,l=o-s,u=(o+s)/2;return l?(h=i===o?(r-a)/l+6*(a>r):r===o?(a-i)/l+2:(i-r)/l+4,l/=.5>u?o+s:2-o-s,h*=60):l=u>0&&1>u?0:h,new c(h,l,u,t.opacity)}function u(t,e,n,i){return 1===arguments.length?l(t):new c(t,e,n,null==i?1:i)}function c(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function d(t,e,n){return 255*(60>t?e+(n-e)*t/60:180>t?n:240>t?e+(n-e)*(240-t)/60:e)}function g(t){if(t instanceof y)return new y(t.l,t.a,t.b,t.opacity);if(t instanceof v){var e=t.h*E;return new y(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof o||(t=a(t));var n=m(t.r),i=m(t.g),r=m(t.b),s=f((.4124564*n+.3575761*i+.1804375*r)/H),h=f((.2126729*n+.7151522*i+.072175*r)/J),l=f((.0193339*n+.119192*i+.9503041*r)/K);return new y(116*h-16,500*(s-h),200*(h-l),t.opacity)}function p(t,e,n,i){return 1===arguments.length?g(t):new y(t,e,n,null==i?1:i)}function y(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function f(t){return t>U?Math.pow(t,1/3):t/T+Q}function b(t){return t>R?t*t*t:T*(t-Q)}function w(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function m(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function k(t){if(t instanceof v)return new v(t.h,t.c,t.l,t.opacity);t instanceof y||(t=g(t));var e=Math.atan2(t.b,t.a)*F;return new v(0>e?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function N(t,e,n,i){return 1===arguments.length?k(t):new v(t,e,n,null==i?1:i)}function v(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function M(t){if(t instanceof q)return new q(t.h,t.s,t.l,t.opacity);t instanceof o||(t=a(t));var e=t.r/255,n=t.g/255,i=t.b/255,r=(rt*i+nt*e-it*n)/(rt+nt-it),s=i-r,h=(et*(n-r)-Z*s)/tt,l=Math.sqrt(h*h+s*s)/(et*r*(1-r)),u=l?Math.atan2(h,s)*F-120:NaN;return new q(0>u?u+360:u,l,r,t.opacity)}function x(t,e,n,i){return 1===arguments.length?M(t):new q(t,e,n,null==i?1:i)}function q(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}var $=.7,I=1/$,P=/^#([0-9a-f]{3})$/,j=/^#([0-9a-f]{6})$/,S=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,z=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,C=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,L=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,O=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,_=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,A={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};n.prototype=e.prototype={displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}};var B=s.prototype=o.prototype=new e;B.brighter=function(t){return t=null==t?I:Math.pow(I,t),new o(this.r*t,this.g*t,this.b*t,this.opacity)},B.darker=function(t){return t=null==t?$:Math.pow($,t),new o(this.r*t,this.g*t,this.b*t,this.opacity)},B.rgb=function(){return this},B.displayable=function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},B.toString=function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")};var D=u.prototype=c.prototype=new e;D.brighter=function(t){return t=null==t?I:Math.pow(I,t),new c(this.h,this.s,this.l*t,this.opacity)},D.darker=function(t){return t=null==t?$:Math.pow($,t),new c(this.h,this.s,this.l*t,this.opacity)},D.rgb=function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(.5>n?n:1-n)*e,r=2*n-i;return new o(d(t>=240?t-240:t+120,r,i),d(t,r,i),d(120>t?t+240:t-120,r,i),this.opacity)},D.displayable=function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1};var E=Math.PI/180,F=180/Math.PI,G=18,H=.95047,J=1,K=1.08883,Q=4/29,R=6/29,T=3*R*R,U=R*R*R,V=p.prototype=y.prototype=new e;V.brighter=function(t){return new y(this.l+G*(null==t?1:t),this.a,this.b,this.opacity)},V.darker=function(t){return new y(this.l-G*(null==t?1:t),this.a,this.b,this.opacity)},V.rgb=function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=J*b(t),e=H*b(e),n=K*b(n),new o(w(3.2404542*e-1.5371385*t-.4985314*n),w(-.969266*e+1.8760108*t+.041556*n),w(.0556434*e-.2040259*t+1.0572252*n),this.opacity)};var W=N.prototype=v.prototype=new e;W.brighter=function(t){return new v(this.h,this.c,this.l+G*(null==t?1:t),this.opacity)},W.darker=function(t){return new v(this.h,this.c,this.l-G*(null==t?1:t),this.opacity)},W.rgb=function(){return g(this).rgb()};var X=-.14861,Y=1.78277,Z=-.29227,tt=-.90649,et=1.97294,nt=et*tt,it=et*Y,rt=Y*Z-tt*X,at=x.prototype=q.prototype=new e;at.brighter=function(t){return t=null==t?I:Math.pow(I,t),new q(this.h,this.s,this.l*t,this.opacity)},at.darker=function(t){return t=null==t?$:Math.pow($,t),new q(this.h,this.s,this.l*t,this.opacity)},at.rgb=function(){var t=isNaN(this.h)?0:(this.h+120)*E,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),r=Math.sin(t);return new o(255*(e+n*(X*i+Y*r)),255*(e+n*(Z*i+tt*r)),255*(e+n*(et*i)),this.opacity)};var st="0.4.1";t.version=st,t.color=n,t.rgb=s,t.hsl=u,t.lab=p,t.hcl=N,t.cubehelix=x});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.d3_color=t.d3_color||{})}(this,function(t){"use strict";function e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function n(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function i(){}function r(t){var e;return t=(t+"").trim().toLowerCase(),(e=O.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=S.exec(t))?a(parseInt(e[1],16)):(e=_.exec(t))?new l(e[1],e[2],e[3],1):(e=z.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=C.exec(t))?s(e[1],e[2],e[3],e[4]):(e=L.exec(t))?s(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=A.exec(t))?u(e[1],e[2]/100,e[3]/100,1):(e=B.exec(t))?u(e[1],e[2]/100,e[3]/100,e[4]):D.hasOwnProperty(t)?a(D[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function a(t){return new l(t>>16&255,t>>8&255,255&t,1)}function s(t,e,n,i){return 0>=i&&(t=e=n=NaN),new l(t,e,n,i)}function o(t){return t instanceof i||(t=r(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function h(t,e,n,i){return 1===arguments.length?o(t):new l(t,e,n,null==i?1:i)}function l(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}function u(t,e,n,i){return 0>=i?t=e=n=NaN:0>=n||n>=1?t=e=NaN:0>=e&&(t=NaN),new g(t,e,n,i)}function c(t){if(t instanceof g)return new g(t.h,t.s,t.l,t.opacity);if(t instanceof i||(t=r(t)),!t)return new g;if(t instanceof g)return t;t=t.rgb();var e=t.r/255,n=t.g/255,a=t.b/255,s=Math.min(e,n,a),o=Math.max(e,n,a),h=NaN,l=o-s,u=(o+s)/2;return l?(h=e===o?(n-a)/l+6*(a>n):n===o?(a-e)/l+2:(e-n)/l+4,l/=.5>u?o+s:2-o-s,h*=60):l=u>0&&1>u?0:h,new g(h,l,u,t.opacity)}function d(t,e,n,i){return 1===arguments.length?c(t):new g(t,e,n,null==i?1:i)}function g(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}function p(t,e,n){return 255*(60>t?e+(n-e)*t/60:180>t?n:240>t?e+(n-e)*(240-t)/60:e)}function f(t){if(t instanceof y)return new y(t.l,t.a,t.b,t.opacity);if(t instanceof x){var e=t.h*E;return new y(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var n=N(t.r),i=N(t.g),r=N(t.b),a=w((.4124564*n+.3575761*i+.1804375*r)/H),s=w((.2126729*n+.7151522*i+.072175*r)/J),h=w((.0193339*n+.119192*i+.9503041*r)/K);return new y(116*s-16,500*(a-s),200*(s-h),t.opacity)}function b(t,e,n,i){return 1===arguments.length?f(t):new y(t,e,n,null==i?1:i)}function y(t,e,n,i){this.l=+t,this.a=+e,this.b=+n,this.opacity=+i}function w(t){return t>U?Math.pow(t,1/3):t/T+Q}function m(t){return t>R?t*t*t:T*(t-Q)}function k(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function N(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function M(t){if(t instanceof x)return new x(t.h,t.c,t.l,t.opacity);t instanceof y||(t=f(t));var e=Math.atan2(t.b,t.a)*F;return new x(0>e?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function v(t,e,n,i){return 1===arguments.length?M(t):new x(t,e,n,null==i?1:i)}function x(t,e,n,i){this.h=+t,this.c=+e,this.l=+n,this.opacity=+i}function q(t){if(t instanceof I)return new I(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,n=t.g/255,i=t.b/255,r=(nt*i+tt*e-et*n)/(nt+tt-et),a=i-r,s=(Z*(n-r)-X*a)/Y,h=Math.sqrt(s*s+a*a)/(Z*r*(1-r)),u=h?Math.atan2(s,a)*F-120:NaN;return new I(0>u?u+360:u,h,r,t.opacity)}function $(t,e,n,i){return 1===arguments.length?q(t):new I(t,e,n,null==i?1:i)}function I(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}var j=.7,P=1/j,O=/^#([0-9a-f]{3})$/,S=/^#([0-9a-f]{6})$/,_=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,z=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,C=/^rgba\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,L=/^rgba\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,A=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,B=/^hsla\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)\s*\)$/,D={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};e(i,r,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),e(l,h,n(i,{brighter:function(t){return t=null==t?P:Math.pow(P,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?j:Math.pow(j,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),e(g,d,n(i,{brighter:function(t){return t=null==t?P:Math.pow(P,t),new g(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?j:Math.pow(j,t),new g(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(.5>n?n:1-n)*e,r=2*n-i;return new l(p(t>=240?t-240:t+120,r,i),p(t,r,i),p(120>t?t+240:t-120,r,i),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var E=Math.PI/180,F=180/Math.PI,G=18,H=.95047,J=1,K=1.08883,Q=4/29,R=6/29,T=3*R*R,U=R*R*R;e(y,b,n(i,{brighter:function(t){return new y(this.l+G*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new y(this.l-G*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return t=J*m(t),e=H*m(e),n=K*m(n),new l(k(3.2404542*e-1.5371385*t-.4985314*n),k(-.969266*e+1.8760108*t+.041556*n),k(.0556434*e-.2040259*t+1.0572252*n),this.opacity)}})),e(x,v,n(i,{brighter:function(t){return new x(this.h,this.c,this.l+G*(null==t?1:t),this.opacity)},darker:function(t){return new x(this.h,this.c,this.l-G*(null==t?1:t),this.opacity)},rgb:function(){return f(this).rgb()}}));var V=-.14861,W=1.78277,X=-.29227,Y=-.90649,Z=1.97294,tt=Z*Y,et=Z*W,nt=W*X-Y*V;e(I,$,n(i,{brighter:function(t){return t=null==t?P:Math.pow(P,t),new I(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?j:Math.pow(j,t),new I(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*E,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),i=Math.cos(t),r=Math.sin(t);return new l(255*(e+n*(V*i+W*r)),255*(e+n*(X*i+Y*r)),255*(e+n*(Z*i)),this.opacity)}}));var it="0.4.2";t.version=it,t.color=r,t.rgb=h,t.hsl=d,t.lab=b,t.hcl=v,t.cubehelix=$});
{
"name": "d3-color",
"version": "0.4.1",
"version": "0.4.2",
"description": "Color spaces! RGB, HSL, Cubehelix, Lab and HCL (Lch).",

@@ -31,3 +31,3 @@ "keywords": [

"prepublish": "npm run test && uglifyjs build/d3-color.js -c -m -o build/d3-color.min.js && rm -f build/d3-color.zip && zip -j build/d3-color.zip -- LICENSE README.md build/d3-color.js build/d3-color.min.js",
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git tag -am \"Release $VERSION.\" v${VERSION} && git push --tags && cp build/d3-color.js ../d3.github.com/d3-color.v0.4.js && cp build/d3-color.min.js ../d3.github.com/d3-color.v0.4.min.js && cd ../d3.github.com && git add d3-color.v0.4.js d3-color.v0.4.min.js && git commit -m \"d3-color ${VERSION}\" && git push"
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-color.js ../d3.github.com/d3-color.v0.4.js && cp build/d3-color.min.js ../d3.github.com/d3-color.v0.4.min.js && cd ../d3.github.com && git add d3-color.v0.4.js d3-color.v0.4.min.js && git commit -m \"d3-color ${VERSION}\" && git push"
},

@@ -34,0 +34,0 @@ "devDependencies": {

@@ -0,1 +1,3 @@

import define, {extend} from "./define";
export function Color() {}

@@ -166,3 +168,3 @@

color.prototype = Color.prototype = {
define(Color, color, {
displayable: function() {

@@ -174,3 +176,3 @@ return this.rgb().displayable();

}
};
});

@@ -220,34 +222,30 @@ export default function color(format) {

var _rgb = rgb.prototype = Rgb.prototype = new Color;
define(Rgb, rgb, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function() {
return this;
},
displayable: function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
},
toString: function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
}
}));
_rgb.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
};
_rgb.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
};
_rgb.rgb = function() {
return this;
};
_rgb.displayable = function() {
return (0 <= this.r && this.r <= 255)
&& (0 <= this.g && this.g <= 255)
&& (0 <= this.b && this.b <= 255)
&& (0 <= this.opacity && this.opacity <= 1);
};
_rgb.toString = function() {
var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(")
+ Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
+ Math.max(0, Math.min(255, Math.round(this.b) || 0))
+ (a === 1 ? ")" : ", " + a + ")");
};
function hsla(h, s, l, a) {

@@ -297,34 +295,31 @@ if (a <= 0) h = s = l = NaN;

var _hsl = hsl.prototype = Hsl.prototype = new Color;
define(Hsl, hsl, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
},
displayable: function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
}
}));
_hsl.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
};
_hsl.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
};
_hsl.rgb = function() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
hsl2rgb(h, m1, m2),
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
this.opacity
);
};
_hsl.displayable = function() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s))
&& (0 <= this.l && this.l <= 1)
&& (0 <= this.opacity && this.opacity <= 1);
};
/* From FvD 13.37, CSS Color Module Level 3 */

@@ -331,0 +326,0 @@ function hsl2rgb(h, m1, m2) {

@@ -0,1 +1,2 @@

import define, {extend} from "./define";
import {Color, rgbConvert, Rgb, darker, brighter} from "./color";

@@ -38,26 +39,24 @@ import {deg2rad, rad2deg} from "./math";

var _cubehelix = cubehelix.prototype = Cubehelix.prototype = new Color;
_cubehelix.brighter = function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
};
_cubehelix.darker = function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
};
_cubehelix.rgb = function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
};
define(Cubehelix, cubehelix, extend(Color, {
brighter: function(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function() {
var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
return new Rgb(
255 * (l + a * (A * cosh + B * sinh)),
255 * (l + a * (C * cosh + D * sinh)),
255 * (l + a * (E * cosh)),
this.opacity
);
}
}));

@@ -0,1 +1,2 @@

import define, {extend} from "./define";
import {Color, rgbConvert, Rgb} from "./color";

@@ -40,27 +41,25 @@ import {deg2rad, rad2deg} from "./math";

var _lab = lab.prototype = Lab.prototype = new Color;
define(Lab, lab, extend(Color, {
brighter: function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
rgb: function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
}
}));
_lab.brighter = function(k) {
return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
};
_lab.darker = function(k) {
return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
};
_lab.rgb = function() {
var y = (this.l + 16) / 116,
x = isNaN(this.a) ? y : y + this.a / 500,
z = isNaN(this.b) ? y : y - this.b / 200;
y = Yn * lab2xyz(y);
x = Xn * lab2xyz(x);
z = Zn * lab2xyz(z);
return new Rgb(
xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z),
this.opacity
);
};
function xyz2lab(t) {

@@ -100,14 +99,12 @@ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;

var _hcl = hcl.prototype = Hcl.prototype = new Color;
_hcl.brighter = function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
};
_hcl.darker = function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
};
_hcl.rgb = function() {
return labConvert(this).rgb();
};
define(Hcl, hcl, extend(Color, {
brighter: function(k) {
return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
},
darker: function(k) {
return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
},
rgb: function() {
return labConvert(this).rgb();
}
}));
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc