JSFiddle - React, Tailwind, and code Playground
by devgru
JavaScript
function d3 () {}
function d3_Color() {}
d3_Color.prototype.toString = function() {
return this.rgb() + "";
};
d3.lab = function(l, a, b) {
return arguments.length === 1
? (l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b)
: (l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h)
: d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b)))
: d3_lab(+l, +a, +b);
};
function d3_lab(l, a, b) {
return new d3_Lab(l, a, b);
}
function d3_Lab(l, a, b) {
this.l = l;
this.a = a;
this.b = b;
}
// Corresponds roughly to RGB brighter/darker
var d3_lab_K = 18;
// D65 standard referent
var d3_lab_X = 0.950470,
d3_lab_Y = 1,
d3_lab_Z = 1.088830;
var d3_labPrototype = d3_Lab.prototype = new d3_Color;
d3_labPrototype.rgb = function() {
return d3_lab_rgb(this.l, this.a, this.b);
};
function d3_lab_rgb(l, a, b) {
var y = (l + 16) / 116,
x = y + a / 500,
z = y - b / 200;
x = d3_lab_xyz(x) * d3_lab_X;
y = d3_lab_xyz(y) * d3_lab_Y;
z = d3_lab_xyz(z) * d3_lab_Z;
return d3_rgb(
d3_xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
d3_xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
d3_xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
);
}
function d3_lab_hcl(l, a, b) {
return l > 0
? d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l)
: d3_hcl(NaN, NaN, l);
}
function d3_lab_xyz(x) {
return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
}
function d3_xyz_lab(x) {
return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
}
function d3_xyz_rgb(r) {
return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
}
d3.rgb = function(r, g, b) {
return arguments.length === 1
? (r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b)
: d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
: d3_rgb(~~r, ~~g, ~~b);
};
function d3_rgbNumber(value) {
return d3_rgb(value >> 16, value >> 8 & 0xff, value & 0xff);
}
function...