Contrast Proof
ProNewSwap ink and paper swatches on a live type specimen and measure their WCAG contrast ratio.
Installation
pnpm dlx shadcn@latest add @viewport/contrast-proof
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| colors* | Ink[]Six-digit hexadecimal colors, including the leading hash. | — |
| specimen | stringType sample shown in the chosen foreground and background. | "Aa" |
Accessibility
- Swatch buttons are labeled and expose pressed state. The ratio and AA result are written in text.