Integration · Setup
Contrast embed A contrast checker for your own page, in one iframe
One iframe puts a contrast checker on your page: two colors, the ratio, five WCAG checks, and the nearest text color that passes. It is 13.6 KB compressed, works out every number with this site’s own color engine, and stores and sends nothing.
- Needs
- A page that can hold an iframe
- Cost
- Free; credit optional
- Checked
Before you start
What you need
- A page where you can paste HTML: a site you build, a CMS that accepts an iframe, or a course page.
- Nothing to install, no account and no key.
Setup
Step by step
-
Copy the iframe
Paste it where the checker should appear. The
titlenames the frame for screen readers: keep it, in your page’s language.<iframe src="https://auricartisan.com/embed/contrast/" title="Contrast checker" width="420" height="620" style="max-width:100%;border:0" loading="lazy"></iframe> -
Choose the colors, the theme and the language
Add any of the options below to the address. Without them it starts with grey on white, follows the reader’s light or dark setting, and speaks English.
The options the address takes Option Values Without it fgThe text color: three or six hex digits, without the # (in an address, # starts a fragment) 8A8A8A bgThe background color, the same way FFFFFF themelightordarkThe reader’s system setting langhifor HindiEnglish credit0hides the credit linkShown https://auricartisan.com/embed/contrast/?fg=1F2937&bg=FFFFFF&theme=dark&lang=hi -
Give it room
The checker does not resize its frame. On the check its content was 601 pixels tall at 420 pixels wide and 717 at 320, so the iframe above is 620 pixels tall; on a narrow column give it 730. A frame that is too short scrolls inside.
-
Credit, if you like
The checker shows a small “Made by Auric Artisan” link, which
credit=0removes. A credit beside the frame is welcome and never required, in any words you like.<p>Contrast checker from <a href="https://auricartisan.com/integrations/embed/">Auric Artisan</a></p>
Try it
The checker, as it embeds
Type a color, or pick one, and press Tab. A pair that fails AA gets the nearest text color that passes, and “Use it” takes it.
Verification
What was checked
The embed as served by the site, in each theme. The last two columns are what each check found.
| Check | What it means | Light theme | Dark theme |
|---|---|---|---|
| Text contrast | Every word the checker writes reaches 4.5:1 on its background. The sample is a picture of your pair, so it is not counted. | 6.53:1 at its lowest Passes | 8.04:1 at its lowest Passes |
| Boundaries | The edges of the fields and buttons reach 3:1 against the background. | 4.84:1 at its lowest Passes | 5.15:1 at its lowest Passes |
| Keyboard focus | Every stop shows a 2-pixel outline at 3:1 or more. | 7 of 7 stops; outline 6.70:1 Passes | 7 of 7 stops; outline 8.41:1 Passes |
| Target size | Every field and button is at least 24 by 24 pixels. | 36 px at the smallest Passes | 36 px at the smallest Passes |
| Forced colors | With forced colors on, every field and button keeps a visible border. | 6 of 6 keep a border Passes | 6 of 6 keep a border Passes |
| Automated rules | axe, with the WCAG 2.2 A and AA rules. | 0 violations Passes | 0 violations Passes |
How it behaves
| Behavior | Result |
|---|---|
| It loads in a frame on another site, and a normal page of this site framed beside it is refused | Passes |
| The ratio and the suggestion are the site’s color engine’s, for the default pair and for a typed one | Passes |
| “Use it” takes the suggestion, and focus returns to the text color | Passes |
| A color it cannot read is marked invalid, with the reason, and the last good pair stays | Passes |
| After a pause, the ratio and the AA result are announced once | Passes |
| At 280 pixels wide nothing scrolls sideways | Passes |
With | Passes |
| Nothing is stored: no cookies, no local storage | Passes |
Weight
Everything it loads
These files, from this site, and nothing else. The check failed if any other request was made.
| File | Size | Compressed |
|---|---|---|
/embed/contrast/ | 6.0 KB | 1.4 KB |
/js/embed/contrast-boot.js | 0.5 KB | 0.3 KB |
/css/embed/contrast.css | 5.3 KB | 1.8 KB |
/js/embed/contrast.js | 4.5 KB | 1.8 KB |
/js/embed/contrast-words.js | 3.5 KB | 1.3 KB |
/js/tool/color-tools/utils/color-core.js | 19.4 KB | 7.0 KB |
| Total | 39.2 KB | 13.6 KB |
Limits
What it does not do
Hex colors only, in three or six digits. Names such as
tealand other notations are not read.- The ratio is WCAG 2’s. APCA is not shown; the full checker on this site has it.
- The suggestion changes the text color, keeping its hue, to reach AA for normal text. Changing the background instead is up to you.
- It does not resize its frame: give it the height above.
Framing was checked on a local copy of the site, which sends the headers that the live site’s
_headersfile sets for/embed/.
Privacy and access
What it stores and sends
- Nothing: no cookies, no local storage, no analytics, and no request beyond the files above. The colors stay in the reader’s browser.
- Its pages allow only their own files to run, so nothing else can be injected into the frame on your site.
- Like every page on this site, it is served through Cloudflare, which sees the request for it.
Go further
The full reference
- The full contrast checker, with APCA
- Check pairs from your own code with the API
- How to fix a contrast failure
- The contrast checker, with every option
- Accessible color and WCAG contrast, explained
Other integrations
- Browser extensionCheck and fix contrast on the page in front of you.
- VS CodeUnderline low contrast in your stylesheets and fix it in place.
- REST APIConvert colors and check pairs from a server or a script.
- Design tokensExport one token system to Tailwind, CSS or Figma.
- Tailwind themeStart a Tailwind v4 project with accessible components.
- React tokensTheme a React app from the token export.
- Figma variablesTurn Figma variables into CSS tokens.
- Contrast in CICheck your color pairs on every pull request.
Checked against
Where these facts come from
Versions, requirements and examples on this page were checked on . The embed was loaded from a local copy of the site in Chromium, in both themes, in Hindi and at four widths, with axe 4.12.1. It was framed from another origin beside a normal page that had to be refused, and its files were measured as served.
- Understanding WCAG 2.2: Contrast (Minimum)www.w3.org
- Understanding WCAG 2.2: Contrast (Enhanced)www.w3.org
- Understanding WCAG 2.2: Non-text Contrastwww.w3.org
- Understanding WCAG 2.2: Target Size (Minimum)www.w3.org
- MDN: The iframe elementdeveloper.mozilla.org
- MDN: CSP frame-ancestorsdeveloper.mozilla.org
- Cloudflare Pages: Headersdevelopers.cloudflare.com
Found a mistake? Write to us and we will correct it.