Color guides

Review the Contrast and Wording of an Inline Form Error

·

Use the built-in email example to check the text, icon, and border separately. The same error foreground can meet the threshold for one role and fall short for another. Confirm that the field still explains the error when hue is hard to distinguish.

Form Error Color Accessibility Checker

Compare bright red and dark red on white

Choose Bright red on white. Keep Error icon and Visible error message selected. The report shows 4.00:1 when rounded for display. That reaches the 3:1 graphics threshold. It falls below the 4.5:1 threshold for the sample’s normal-size message.

Choose Dark red on white. The message and both border comparisons read 7.95:1. Try Preview without hue. Check that the exclamation mark and the text still identify the problem. The filter affects the preview while the report retains the original color values.

W3C Understanding Contrast (Minimum)W3C Understanding Non-text Contrast

Compare the two sides of the error border

Choose Muted coral on gray. Compare Border against field fill and Border against surrounding background. The same line gives 2.99:1 on the inside and 3.58:1 on the outside. If the border is essential to identifying the field’s error state, improve the weaker comparison.

Enable Dashed field border to add a change of shape. Select Show error state twice to compare normal and invalid appearances. A dash pattern gives an extra cue. The pair measurements still use the colors on each side of the border.

W3C Understanding Non-text ContrastW3C Understanding Use of Color

Verify the error description and save the result

Return to Dark red on white and clear Visible error message. The icon can still identify an error state visually. The report asks for text that identifies the field and explains the error. Re-enable the message and check that the sample field references its text using aria-describedby.

Download the JSON report and inspect the raw ratios and cue settings. Apply Preview CSS to the corresponding example classes when reproducing the color check. The CSS changes the painted colors and border shape. Include an associated description in your markup and test how the real form announces errors.

W3C Understanding Use of ColorW3C Understanding Error Identification

Common questions

Why can a displayed 3.00:1 still be below the threshold?

The compact table rounds the displayed ratio. The result compares the full value with the threshold. Inspect the unrounded number in the JSON report.

Can a patterned border replace a clear error message?

A pattern can distinguish the state visually. The error description still needs text that identifies the affected field and the problem.

Sources

Put it into practice.

Related guides