All Projects β†’ colorjs β†’ pick-a-good-color

colorjs / pick-a-good-color

Licence: other
Choose the boldest and most accessible color for a given background.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to pick-a-good-color

a11ycolor
🌈 Generate the nearest accessible color
Stars: ✭ 29 (+61.11%)
Mutual labels:  color, accessibility, contrast
SAPC-APCA
APCA (Accessible Perceptual Contrast Algorithm) is a new method for predicting contrast for use in emerging web standards (WCAG 3) for determining readability contrast. APCA is derived form the SAPC (S-LUV Advanced Predictive Color) which is an accessibility-oriented color appearance model designed for self-illuminated displays.
Stars: ✭ 266 (+1377.78%)
Mutual labels:  color, accessibility, contrast
color-description
Color-Description turns a technical color representation into a human readable description.
Stars: ✭ 18 (+0%)
Mutual labels:  color, accessibility
accessibility-buttons
Buttons to add/remove contrast and increase/decrease font size.
Stars: ✭ 61 (+238.89%)
Mutual labels:  accessibility, contrast
Whocanuse
WhoCanUse is a tool that brings attention and understanding to how color contrast can affect different people with visual impairments.
Stars: ✭ 259 (+1338.89%)
Mutual labels:  color, accessibility
Sass A11ycolor
🌈 Generate the nearest accessible color with Sass.
Stars: ✭ 24 (+33.33%)
Mutual labels:  color, accessibility
Contrast Finder
Contrast-Finder finds correct color contrasts (background / foreground) for web accessibility (a11y, WCAG, RGAA). https://app.contrast-finder.org
Stars: ✭ 38 (+111.11%)
Mutual labels:  color, accessibility
Contrast Swatch
πŸ…°οΈ Image microservice for color contrast information
Stars: ✭ 210 (+1066.67%)
Mutual labels:  color, accessibility
accessibility-ruleset-runner
eBay Accessibility Ruleset Runner automates 20% of WCAG 2.0 AA recommendations, saving time on manual testing.
Stars: ✭ 24 (+33.33%)
Mutual labels:  accessibility
react-color
🎨 Is a tiny color picker widget component for React apps.
Stars: ✭ 50 (+177.78%)
Mutual labels:  color
mapbox-gl-accessibility
An accessibility control for Mapbox GL JS
Stars: ✭ 64 (+255.56%)
Mutual labels:  accessibility
amazon-ivs-auto-captions-web-demo
Use Amazon IVS in conjunction with Amazon Transcribe to deliver real-time captions for live streams.
Stars: ✭ 36 (+100%)
Mutual labels:  accessibility
sveltekit-magic
An implementation of passwordless authentication using Magic with SvelteKit.
Stars: ✭ 38 (+111.11%)
Mutual labels:  magic
hexa
Compiler, standard library & backends
Stars: ✭ 74 (+311.11%)
Mutual labels:  magic
react-awesome-toasts
Toast notifications for react.
Stars: ✭ 64 (+255.56%)
Mutual labels:  accessibility
dorai-ui
Accessible, unstyled, open-sourced, and fully functional react component library for building design systems
Stars: ✭ 34 (+88.89%)
Mutual labels:  accessibility
mkm-sdk
Python SDK for Magickartenmarkt API
Stars: ✭ 33 (+83.33%)
Mutual labels:  magic
mindpatterns
HTML Accessibility Pattern Examples
Stars: ✭ 78 (+333.33%)
Mutual labels:  accessibility
colr
Easy terminal colors, with chainable methods.
Stars: ✭ 32 (+77.78%)
Mutual labels:  color
color-math
Expressions to manipulate colors.
Stars: ✭ 18 (+0%)
Mutual labels:  color

pick-a-good-color

Choose the boldest and most accessible color for a given background.

electron app icon colors

Installation

npm install pick-a-good-color --save

Usage

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})

API

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.

Tests

npm install
npm test

See Also

Dependencies

Dev Dependencies

  • budo: a browserify server for rapid prototyping
  • chai: BDD/TDD assertion library for node.js and the browser. Test framework agnostic.
  • electron-apps: A collection of apps built on Electron
  • mocha: simple, flexible, fun test framework
  • standard: JavaScript Standard Style
  • standard-markdown: Test your Markdown files for Standard JavaScript Styleβ„’
  • yo-yo: A tiny library for building modular UI components using DOM diffing and ES6 tagged template literals

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].