Tailwind violet colours
The eleven violet shades in the default Tailwind CSS palette, with the contrast figures that decide which of them you can actually put text on.
Every violet shade
| Class | Hex | RGB | On white | Text colour | As text |
|---|---|---|---|---|---|
violet-50 | #F5F3FF | 245, 243, 255 | 1.1:1 | black | — |
violet-100 | #EDE9FE | 237, 233, 254 | 1.19:1 | black | — |
violet-200 | #DDD6FE | 221, 214, 254 | 1.39:1 | black | — |
violet-300 | #C4B5FD | 196, 181, 253 | 1.85:1 | black | — |
violet-400 | #A78BFA | 167, 139, 250 | 2.72:1 | black | — |
violet-500 | #8B5CF6 | 139, 92, 246 | 4.23:1 | black | large only |
violet-600 | #7C3AED | 124, 58, 237 | 5.7:1 | white | AA |
violet-700 | #6D28D9 | 109, 40, 217 | 7.1:1 | white | AA |
violet-800 | #5B21B6 | 91, 33, 182 | 8.98:1 | white | AA |
violet-900 | #4C1D95 | 76, 29, 149 | 10.95:1 | white | AA |
violet-950 | #2E1065 | 46, 16, 101 | 15.24:1 | white | AA |
"On white" is the contrast ratio against a white page. "As text" is whether that ratio passes WCAG AA for normal text, which needs 4.5:1; large text needs only 3:1.
Where the scale turns over
violet-600 is the lightest shade that reaches 4.5:1 against white, so it is the first one usable for body text on a white page. It is also where a background of this hue stops taking black text and starts needing white — the two thresholds are 4.5:1 and 4.58:1, and on this scale they fall on the same step.
Using violet in Tailwind
<div class="bg-violet-500 text-black">
<p class="text-violet-600">
The text class above is the lightest violet that still passes AA on a white background.
Frequently asked questions
What is the hex code for Tailwind violet-500?
#8B5CF6 — RGB 139, 92, 246. Full values and contrast for #8B5CF6.
Which Tailwind violet shades can I use for text?
violet-600, violet-700, violet-800, violet-900, violet-950 reach 4.5:1 against white and pass AA for normal text. Anything lighter fails, whatever it looks like on your monitor.
Should text on a violet background be black or white?
Black up to violet-500, white from violet-600 down. The two are never both comfortable: at the crossover neither reaches 4.5:1.