Color Contrast Checker (WCAG) by Nexfield
Check colour contrast without leaving your code. Hover any colour literal — #0040ff, rgb(0 64 255), hsl(225 100% 50%) — in CSS, SCSS, HTML, JSX, Vue, Svelte or any other file, and see its WCAG 2.2 contrast ratio against your backgrounds with AA / AAA results for normal text, large text and UI components.
Made by Nexfield Academy, an online school of UX/UI, graphic and web design.
Features
- Hover contrast. Point at a colour to get a table: ratio, AA text (4.5:1), AA large text (3:1), AAA text (7:1) and non-text contrast for icons, borders and focus rings (3:1, WCAG 1.4.11).
- Any notation. Hex with 3, 4, 6 or 8 digits,
rgb()/rgba() and hsl()/hsla() in both comma and space syntax, percentages and alpha.
- Translucent colours are flattened over the background before measuring, the way a browser paints them.
- Compare two colours. Run Nexfield: Check Color Contrast from the Command Palette. The colour under the cursor or in the selection is filled in for you.
- Your own backgrounds. Compare against your brand surfaces instead of plain white and black.
Need a visual check with a colour picker? Use the free online contrast checker on the Nexfield website.
Settings
| Setting |
Default |
What it does |
nexfieldContrast.hover.enabled |
true |
Show contrast on hover. |
nexfieldContrast.backgrounds |
["#ffffff", "#000000"] |
Backgrounds every hovered colour is compared against. |
Example for a product with a dark surface:
"nexfieldContrast.backgrounds": ["#ffffff", "#17181a", "rgb(242 244 247)"]
How the ratio is calculated
Contrast ratio = (L1 + 0.05) / (L2 + 0.05), where L1 and L2 are the relative luminances of the lighter and the darker colour (WCAG 2.2, contrast minimum). The ratio is rounded down to two decimals before it is compared, so 4.49:1 never passes as 4.5:1.
Privacy
The extension works offline. It sends nothing anywhere and collects no data.
Learn design
Contrast is one of the first things designers learn in a UX/UI course. If you want to go further than the numbers, see the UX/UI design course and the free courses at Nexfield Academy.
License
MIT