Socket
Socket
Sign inDemoInstall

material-category10

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    material-category10

Material Design version of D3's schemeCategory10


Version published
Maintainers
1
Install size
3.93 kB
Created

Readme

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

Last updated on 20 Aug 2018

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc