material-category10
Material Design version of D3's schemeCategory10. For use in D3 chromatic ordinal scales, or wherever Material Design colors are appreciated.
material-category10
:
d3.schemeCategory10
:
Usage
As a drop-in replacement for d3.schemeCategory10
import materialCategory10 from 'material-category10';
const materialColorScale = d3.scaleOrdinal(materialCategory10);
console.log(materialColorScale(0));
console.log(materialColorScale(1));
Without D3
It's just an array of 10 values:
import materialCategory10 from 'material-category10';
console.log(materialCategory10[0]);
console.log(materialCategory10[1]);
You can make a simple chromatic scale function:
import materialCategory10 from 'material-category10';
function materialColorScale(i) {
return materialCategory10[i % 10];
}
console.log(materialColorScale(0));
console.log(materialColorScale(1));