gka / chroma.js

JavaScript library for all kinds of color manipulations
https://vis4.net/chromajs/
Other
9.94k stars 543 forks source link

Feature request: Add a way to retrieve the domain from a color scale #320

Open gewesp opened 9 months ago

gewesp commented 9 months ago

Maybe I missed it in the docs, but there doesn't seem to be a way of retrieving the domain of a color scale.

More specifically, I'd like:

const scale = chroma.scale(['yellow', 'black']).domain([0,100]);
assert(scale.newFunctionToGetMaxDomainValue() === 100);

Should be quite simple to add, no? We can prepare a PR if required.