
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
According to the WHO an estimated 1.3 billion people live with some form of visual impairment. This includes people who are legally blind and people with less than 20/20 vision.
This library helps you achieve the accessibility standards for color contrast outlined in the WCAG 2.0 specification.
npm install wcag-color
ratio
takes two colors, a foreground color, and background color, and returns a contrast ratio. ratio
accepts most color formats:
#0088ff
), shorthand (#08f
) and without hash (08f
)rgb(255, 255, 255)
hsl(210, 100%, 40%)
ratio(foreground: string, background: string) => number
import { ratio } from 'wcag-color'
ratio('hsl(210, 100%, 40%)', '#ffffff') // 5.57
score
takes two colors and returns a score value. Read more below.
score(foreground: string, background: string) => 'Fail' | 'AA Large' | 'AA' | 'AAA'
import { score } from 'wcag-color'
score('hsl(210, 100%, 40%)', '#ffffff') // AA
scoreFromRatio
takes a ratio and returns a score value.
scoreFromRatio(ratio: number) => 'Fail' | 'AA Large' | 'AA' | 'AAA'
import { scoreFromRatio } from 'wcag-color'
scoreFromRatio(7.5) // AAA
best
takes two colors and a background color and returns the color which is
best suited, from a contrast perspective, for that background color.
best(firstColor: string, secondColor: string, background: string) => string
import { best } from 'wcag-color'
best('#ffffff', '#000000', '#ffffff') // #000000
3.0
3.0
.4.5
.7.0
. Valuable for texts that will be read for a longer period of time.FAQs
Color constrast helpers to achieve the WCAG 2.0 standard
The npm package wcag-color receives a total of 4,217 weekly downloads. As such, wcag-color popularity was classified as popular.
We found that wcag-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
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.