Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
A small Javascript package that helps identify if two colors are distinguishable to individuals with different kinds of color blindness.
Given two Hex RGB codes, we can create two simulated RGB codes. These would be the colors seen by a color blind person, depending on color blindness type. Using DeltaE2000 algorithm, we determine if the simulated colors are distingushable. If two simulated colors are not distinguishable, we say that the original colors are not distingushable to the color blind.
npm install safe-dye
After requiring, use any of the available validation functions on a set of 2 colors in HEX, i.e #00A55A
.
The function will return true
if the colors are distinguishable or false
otherwise.
const SafeDye = require('safe-dye');
// Will return true if color1 and color2 are distinguishable for red-green type color blindness (Protanopia)
SafeDye.validateRedGreen(color1, color2);
// Will return true if color1 and color2 are distinguishable for blue-yellow type color blindness (Tritanopia)
SafeDye.validateBlueYellow(color1, color2);
// Will return true if both validateRedGreen and validateBlueYellow return true
SafeDye.validate(color1, color2);
// Will return true if color1 and color2 are distinguishable for normal color vision
SafeDye.validateNormal(color1, color2);
As a frontend developer, I sometimes find myself working on interfaces that allow users to customize color related options. As a simple example, consider choosing the color of text over a different background color for a blog post. While there are various tools out there to simulate color blind vision, we cannot expect our end users to use them when writing a colorful blog post :) With this library, we can provide users with feedback and let them know that certain color combinations can be problematic for some audiences.
This library uses color-blind and DeltaE, which makes this package very simple. Both do a great job in educating about color blindness and visual perceptions of colors - super cool and worth checking out :)
FAQs
Check color similarity in a color-blind safe way
The npm package safe-dye receives a total of 9 weekly downloads. As such, safe-dye popularity was classified as not popular.
We found that safe-dye 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.