Socket
Book a DemoInstallSign in
Socket

material-category10

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

material-category10

Material Design version of D3's schemeCategory10

1.0.2
latest
npmnpm
Version published
Weekly downloads
5
400%
Maintainers
1
Weekly downloads
 
Created
Source

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"

FAQs

Package last updated on 20 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.