Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
distinct-colors
Advanced tools
Generate a palette of visually distinct colors. It's great for charts.
This is a complete rewrite of (but is heavily inspired by) Mathieu Jacomy's Palette Generator
I have taken the ideas and the theories, and put them into a simple modular library. I have also optimized it for speed.
This library generates a palette of visually distinct colors, and returns an array of chroma-js objects.
distinct-colors is highly configurable:
To get an example of how to use this (and what it produces), check out I want hue.
Special thanks to Arthur Andrew Medical for sponsoring this project.
Arthur Andrew Medical manufactures products with ingredients that have extensive clinical research for safety and efficacy. We specialize in Enzymes, Probiotics and Antioxidants.
npm install distinct-colors
// ESM
import distinctColors from 'distinct-colors'
// CommonJS
var distinctColors = require('distinct-colors').default
var palette = distinctColors() // You may pass an optional config object
// Thats it!
Generates a new palette. Returns an array of chroma-js objects.
Name | Type | Valid Range | Default | Description |
---|---|---|---|---|
count | integer | 0-Infinity | 5 | The number of colors the palette should contain |
hueMin | integer | 0-360 | 0 | The minimum hue for colors in the palette. |
hueMax | integer | 0-360 | 360 | The maximum hue for colors in the palette. |
chromaMin | integer | 0-100 | 0 | The minimum chroma (color) for colors in the palette. |
chromaMax | integer | 0-100 | 100 | The maximum chroma (color) for colors in the palette. |
lightMin | integer | 0-100 | 0 | The minimum lightness for colors in the palette. |
lightMax | integer | 0-100 | 100 | The maximum lightness for colors in the palette. |
quality | integer | 1-Infinity | 50 | The number of steps for k-means convergence. Will break early if the result has converged. |
samples | integer | 1-Infinity | 800 | The number of color samples to choose from. |
FAQs
Generate a palette of visually distinct colors. It's great for charts.
We found that distinct-colors demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.