@mapequation/c3
v1.1.1
Published
Consistent Categorical Colors - Deterministic colors for maps
Downloads
3
Readme
C3 - Consistent Categorical Colors
A library to generate distinct categorical colors, written in TypeScript.
Install
npm install @mapequation/c3
Features
- Unlimited colors: Generate as many colors you want
- Any color scheme: We generate color stops on the interval
[0, 1]
. Perfect to use with d3. - Deterministic: You always get the same colors for the same requested number of colors.
- Consistent: If you increase the number of colors, it doesn't change the list of colors you already have.
- Fast: The complexity is
O(n log(n))
forn
colors.
The algorithm is inspired by the Cantor set, which is a fractal that subdivides an interval recursively into smaller subsets.
Authors
Daniel Edler, Anton Eriksson