
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
pick-a-good-color
Advanced tools
Choose the boldest and most accessible color for a given background.
Choose the boldest and most accessible color for a given background.
npm install pick-a-good-color --save
Given an array of colors, this function will attempt to find the most saturated color that meets the recommended WCAG contrast ratio of 4.5:1. If none of the given colors meet the criteria, then the most saturated color in the array will be adjusted to meet the contrast requirements using the make-color-accessible module.
By default, this module will pick a color that will work on a white background:
const pick = require('pick-a-good-color')
const colors = ['#DB1AC2', '#C70C4D', '#6B0964', '#5D2BD6', '#088C00']
const goodColor = pick(colors)
// => #C70C4D
If you need a color that will work on a black background, set the
background option:
const goodColor = pick(colors, {background: 'black'})
For large text, the WCAG
recommends
a lower minimum ratio of 3:1.
To change the minimum required contrast, set the contrast option:
const goodColor = pick(colors, {contrast: 3})
pickAGoodColor(colors[, options])colors - An array of hex strings, html color names like black or white, or any other input accepted by the color2 module. (required)options - An object. Optional.
contrast - A number representing the minimum required contrast ratio between options.background and a color in the colors argument. Defaults to the WCAG recommendation of 4.5. Can be any number between 1 and 21.background - A hex string, html color name like black or white, or any other input accepted by the color2 module. Defaults to white.npm install
npm test
MIT
FAQs
Choose the boldest and most accessible color for a given background.
The npm package pick-a-good-color receives a total of 32 weekly downloads. As such, pick-a-good-color popularity was classified as not popular.
We found that pick-a-good-color 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
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.