Renaud
Renaud

Reputation: 4668

d3.js range of values for lab colour

I am working on an X-colours palette (kinda like this one) but based on d3's lab colour space implementation. I have read the documentation here, here and here, even had a look at the source code here and I figured that l-value must be within [0,100] but I couldn't find a range for a and b. Does any value work with them or are they bound to a specific range (like [0, 255] for rgb for example)?

Upvotes: 3

Views: 1034

Answers (1)

Pablo Navarro
Pablo Navarro

Reputation: 8264

The a parameter is a point in the range yellow-blue component and the b parameter is a value in the green-magenta component. It's hard to determine valid range values for a and b, as the valid range depends on the value of the parameter L (which is expected to be in the range [0, 100]). This article contains more details. You could use d3.interpolateLab(l, a, b). In this context, a and b are object that can be interpreted as colors (string, d3.rgb, d3.hsv).

Upvotes: 2

Related Questions