About Violet
Violet (violet) is a light, vivid magenta with the hex code #ee82ee, or rgb(238, 130, 238). In HSL it sits at a hue of 300°, 76% saturation and 72% lightness. It is one of the 148 named colors every browser understands, so you can write color: violet; instead of the hex value.
Using Violet for text and backgrounds
| Pairing | Contrast ratio | WCAG |
|---|---|---|
| Violet text on white | 2.32 : 1 | fails |
| Violet text on black | 9.06 : 1 | AAA |
On a violet background, use black text (9.06 : 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: violet; /* or #ee82ee */
background-color: #ee82ee;
border: 1px solid rgb(238 130 238 / 50%);
}
Similar named colors
Orchid (#da70d6), Plum (#dda0dd), Hot Pink (#ff69b4), Thistle (#d8bfd8), Light Pink (#ffb6c1), Pink (#ffc0cb).