One-line GitHub Action: contrast checks every brand pair on every push, annotates the PR, and fails the build when AA is missed.
- uses: colorui/contrast-action@v1
with:
pairs: |
#0a0a0a #ffffff body
#ffffff #0a4cff button-primary
#525252 #ffffff body-mutedExits 1 on any failure. Wire it into branch protection rules and merge stops until contrast passes.
Each pair becomes a ::notice or ::error in the workflow log, surfaced as an annotation on the PR check.
A Markdown table with every pair, ratio, grade, and pass/fail icon - rendered directly in the workflow run summary.
Calls the public colorui.io/api/v1/contrast endpoint. No GitHub token, no API key, no secrets to manage.
Pure YAML + a tiny Node script. No Docker pull, no bundled dist, nothing to audit beyond ~120 lines of JS.
Set api-base: https://colorui.internal.acme.com to point at your own deployment. Same edge-fast endpoint.
| Input | Default | Description |
|---|---|---|
| pairs | - | Multiline list of `fg bg [label]`. |
| fg | - | Single-pair foreground shortcut. |
| bg | - | Single-pair background shortcut. |
| level | AA | AAA, AA, or AA-Large. |
| api-base | colorui.io | Override for self-hosted deployments. |
| fail-on-error | true | Set false to report without failing. |
Add a step like uses: colorui/contrast-action@v1 with a pairs: input listing your brand color combinations. Full snippet on this page.
Not by default - it writes the report to the workflow step summary and emits inline annotations. To turn it into a PR comment, pipe outputs.report through actions/github-script (snippet in the README).
Default AA (4.5:1 for body text). Set level: AAA for 7:1 or level: AA-Large for 3:1.
No - each pair is a single sub-100ms HTTPS call to a Vercel Edge endpoint. Ten pairs cost roughly one second of wall time.
No. The action is unauthenticated and rate-limited 60 requests per minute per runner egress IP. For high-volume monorepos, set api-base: to a self-hosted deployment.
The action lives in the open at github-action/ in the colorui.io repo. action.yml + index.js + README. Audit it before adding to your workflow.