About Yellow
Yellow (yellow) is a medium, vivid yellow with the hex code #ffff00, or rgb(255, 255, 0). In HSL it sits at a hue of 60°, 100% saturation and 50% lightness. It is one of the 148 named colors every browser understands, so you can write color: yellow; instead of the hex value.
Using Yellow for text and backgrounds
| Pairing | Contrast ratio | WCAG |
|---|---|---|
| Yellow text on white | 1.07 : 1 | fails |
| Yellow text on black | 19.56 : 1 | AAA |
On a yellow background, use black text (19.56 : 1). WCAG asks for at least 4.5 : 1 for body text and 3 : 1 for large text. Check other pairs with the Contrast Checker.
CSS
.element {
color: yellow; /* or #ffff00 */
background-color: #ffff00;
border: 1px solid rgb(255 255 0 / 50%);
}
Similar named colors
Gold (#ffd700), Orange (#ffa500), Green Yellow (#adff2f), Goldenrod (#daa520), Dark Orange (#ff8c00), Yellow Green (#9acd32).