JSPM

@karnak19/passes-wcag

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q50804F
  • License GPL-3.0

Evaluate if a to colors have sufficient contrast to pass WCAG requirements.

Package Exports

  • @karnak19/passes-wcag
  • @karnak19/passes-wcag/dist/index.js
  • @karnak19/passes-wcag/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@karnak19/passes-wcag) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Greenkeeper badge Build Status

Passes WCAG

Typescript version, forked from misund/passes-wcag.

Evaluate whether two colors have sufficient contrast to pass WCAG requirements.

Doesn't handle transparency as of yet.

Installation

npm i passes-wcag

Usage

import {
  passesWcagAaLargeText,
  passesWcagAa,
  passesWcagAaa,
} from "passes-wcag";

passesWcagAa("black", "#fff"); // true
passesWcagAaLargeText("rgb(1, 1, 1)", "rgb(250, 248, 247)"); // true
passesWcagAaa("black", "rgb(0, 0, 0)"); // false

Signature

passesWcagAaLargeText(color1: string, color2: string) => boolean
passesWcagAa(color1: string, color2: string) => boolean
passesWcagAaa(color1: string, color2: string) => boolean

Contributing

I appreciate your issues and PRs on Github!

Testing

yarn build && yarn test

Releasing

This project uses np.

  1. Make sure your changes are in master
  2. Run yarn release
  3. Follow the interactive release guide