Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master

This branch is 602 commits behind d3:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


A plugin for CIE L*a*b* support.

To create a L*a*b* color, use the d3.cie.lab constructor:

var color = d3.cie.lab(51.48, -55.52, 52.88);

The constructor might also parse a CSS3 string, for convenience:

var color = d3.cie.lab("lab(51.48,-55.52,52.88)");

Likewise, to convert from RGB to L*a*b*, simply specify an RGB color. These are all equivalent:

var color = d3.cie.lab("#048F07");
var color = d3.cie.lab("rgb(4,143,7)");
var color = d3.cie.lab(d3.rgb(4, 143, 7));

To convert back to RGB, you can simply toString the object; thus, it is suitable for us in conjunction with selection.attr and"body")
    .style("background", d3.cie.lab(51.48, -55.52, 52.88));

This plugin also lets you interpolates in L*a*b* space. For example:

var x = d3.scale.linear()
    .domain([0, 100])
    .range(["brown", "steelblue"])
Something went wrong with that request. Please try again.