1.0.2 • Published 6 years ago

material-category10 v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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:

materialCategory10

d3.schemeCategory10:

schemeCategory10

Usage

As a drop-in replacement for d3.schemeCategory10

import materialCategory10 from 'material-category10';

const materialColorScale = d3.scaleOrdinal(materialCategory10);

console.log(materialColorScale(0)); // "#2196F3"
console.log(materialColorScale(1)); // "#FF9800"

Without D3

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"
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago