Web development

Communicate status with text as well as color

Present status using meaningful text as well as visual color. A label such as Failed or Complete remains useful when color differences are hard to perceive or styles are unavailable.

Worked example

HTML example · save as example.html and open in a browser

<style>
.status{padding:.3rem .6rem;border:1px solid currentColor;border-radius:.25rem}
.failed{color:#8b1d22;background:#fff1f2}
</style>
<p><span class="status failed">Failed</span> The selected file could not be parsed.</p>

How it works

The label carries the state, while color reinforces it. The explanation identifies the problem more precisely than a red dot would. This also supports searching, copying, and assistive-technology output because the meaning is present as ordinary text.

Limits and mistakes

Contrast must be checked using the actual foreground and background colors and applicable text size. A meaningful label does not make low-contrast text readable. Avoid relying on an icon’s shape alone without an accessible name or adjacent explanation.

Check the result

View the status in grayscale and with styles disabled. Confirm the state and next diagnostic step remain clear, then check contrast with a suitable accessibility tool.

Sources

Reference documentation for the behavior used in this guide: