![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
color-contrast
Advanced tools
performance-sensitive wcag contrast ratio calculation between two colors
Performance-sensitive WCAG contrast ratio calculation.
Note: This project is in early development, and versioning is a little different. Read this for more details.
There are several projects that give you the contrast ratio, but I was unable to find any that didn't have too many dependencies to be viable for performance-conscious browser use and were also wcag-compliant. This one is both. It's ~5kb gzipped, and supports all color formats supported by css, so no need to run any type of color conversions in or out.
npm install color-contrast
This is a very simple module, it only exposes a single export and can be used as such:
import colorContrast from 'color-contrast'
colorContrast('#fff', '#000') // => 21
colorContrast('#fff', '#eee') // => 1.1602304710270739
WCAG standards dictate that you want >=4.5
as a ratio for AA compliance and >= 7
for AAA compliance. You should aim for the latter if possible.
FAQs
performance-sensitive wcag contrast ratio calculation between two colors
The npm package color-contrast receives a total of 4,815 weekly downloads. As such, color-contrast popularity was classified as popular.
We found that color-contrast 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.