Skip to content

Instantly share code, notes, and snippets.

@ijprest
ijprest / colors.js
Last active August 29, 2015 14:26 — forked from mikelikespie/colors.js
Quick code to convert sRGB to CIE L*a*b* and back.
var $color = {};
(function () {
function Lab (l, a, b) { this.l = l; this.a = a; this.b = b; }
$color.Lab = function (l,a,b) { return new Lab(l,a,b); };
function XYZ (x, y, z) { this.x = x; this.y = y; this.z = z; }
$color.XYZ = function (l,a,b) { return new XYZ(x, y, z); };
function sRGBLinear (r, g, b) { this.r = r; this.g = g; this.b = b; }
$color.sRGBLinear = function (r,g,b) { return new sRGBLinear(r,g,b); };