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
:
import materialCategory10 from 'material-category10';
const materialColorScale = d3.scaleOrdinal(materialCategory10);
console.log(materialColorScale(0)); // "#2196F3"
console.log(materialColorScale(1)); // "#FF9800"
It's just an array of 10 values:
import materialCategory10 from 'material-category10';
console.log(materialCategory10[0]); // "#2196F3"
console.log(materialCategory10[1]); // "#FF9800"
You can make a simple chromatic scale function:
import materialCategory10 from 'material-category10';
function materialColorScale(i) {
return materialCategory10[i % 10];
}
console.log(materialColorScale(0)); // "#2196F3"
console.log(materialColorScale(1)); // "#FF9800"