Lessons · HTML and CSS · colour is never the only signal
Colour is never the only signal
If colour is the only thing carrying a meaning, that meaning is gone for anyone who does not perceive it.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Around one in twelve men has some colour vision deficiency. The fix is not a different colour: it is a second signal.
How to think about it
Add a message, an icon, a label, a dash pattern. These fixes are usually just better design -- direct labels on a chart beat a colour key for everybody, because nobody enjoys moving their eye to a key and back.
Worked example
<p class="err">Email is required</p>A red border says something is wrong. The sentence says what, to everybody.
Your turn
A red border needs a second signal, such as
a
Write a page and watch it render
The trap
A link inside a paragraph distinguished from the text by colour alone is invisible to a reader who does not see the colour, in the middle of a sentence where it matters most. That is why links in body text are underlined.