Tailwind CSS Text Color
Text color defines the color of text content for web elements. It is one of the foundational features used to improve readability, align designs with branding guidelines, and focus user attention.
Tailwind provides a bunch of text color utility classes to allow developers to style text with precision and efficiency. In this guide, we will learn how to set text color utilities of Tailwind CSS:
Class | Properties | Example |
---|---|---|
text-inherit | color: inherit; | <div className="text-inherit"></div> |
text-current | color: currentColor; | <div className="text-current"></div> |
text-transparent | color: transparent; | <div className="text-transparent"></div> |
text-black | color: rgb(0 0 0 / var(--tw-text-opacity, 1)); | <div className="text-black"></div> |
text-white | color: rgb(255 255 255 / var(--tw-text-opacity, 1)); | <div className="text-white"></div> |
text-slate-50 | color: rgb(248 250 252 / var(--tw-text-opacity, 1)); | <div className="text-slate-50"></div> |
text-slate-100 | color: rgb(241 245 249 / var(--tw-text-opacity, 1)); | <div className="text-slate-100"></div> |
text-slate-200 | color: rgb(226 232 240 / var(--tw-text-opacity, 1)); | <div className="text-slate-200"></div> |
text-slate-300 | color: rgb(203 213 225 / var(--tw-text-opacity, 1)); | <div className="text-slate-300"></div> |
text-slate-400 | color: rgb(148 163 184 / var(--tw-text-opacity, 1)); | <div className="text-slate-400"></div> |
text-slate-500 | color: rgb(100 116 139 / var(--tw-text-opacity, 1)); | <div className="text-slate-500"></div> |
text-slate-600 | color: rgb(71 85 105 / var(--tw-text-opacity, 1)); | <div className="text-slate-600"></div> |
text-slate-700 | color: rgb(51 65 85 / var(--tw-text-opacity, 1)); | <div className="text-slate-700"></div> |
text-slate-800 | color: rgb(30 41 59 / var(--tw-text-opacity, 1)); | <div className="text-slate-800"></div> |
text-slate-900 | color: rgb(15 23 42 / var(--tw-text-opacity, 1)); | <div className="text-slate-900"></div> |
text-slate-950 | color: rgb(2 6 23 / var(--tw-text-opacity, 1)); | <div className="text-slate-950"></div> |
text-gray-50 | color: rgb(249 250 251 / var(--tw-text-opacity, 1)); | <div className="text-gray-50"></div> |
text-gray-100 | color: rgb(243 244 246 / var(--tw-text-opacity, 1)); | <div className="text-gray-100"></div> |
text-gray-200 | color: rgb(229 231 235 / var(--tw-text-opacity, 1)); | <div className="text-gray-200"></div> |
text-gray-300 | color: rgb(209 213 219 / var(--tw-text-opacity, 1)); | <div className="text-gray-300"></div> |
text-gray-400 | color: rgb(156 163 175 / var(--tw-text-opacity, 1)); | <div className="text-gray-400"></div> |
text-gray-500 | color: rgb(107 114 128 / var(--tw-text-opacity, 1)); | <div className="text-gray-500"></div> |
text-gray-600 | color: rgb(75 85 99 / var(--tw-text-opacity, 1)); | <div className="text-gray-600"></div> |
text-gray-700 | color: rgb(55 65 81 / var(--tw-text-opacity, 1)); | <div className="text-gray-700"></div> |
text-gray-800 | color: rgb(31 41 55 / var(--tw-text-opacity, 1)); | <div className="text-gray-800"></div> |
text-gray-900 | color: rgb(17 24 39 / var(--tw-text-opacity, 1)); | <div className="text-gray-900"></div> |
text-gray-950 | color: rgb(3 7 18 / var(--tw-text-opacity, 1)); | <div className="text-gray-950"></div> |
text-zinc-50 | color: rgb(250 250 250 / var(--tw-text-opacity, 1)); | <div className="text-zinc-50"></div> |
text-zinc-100 | color: rgb(244 244 245 / var(--tw-text-opacity, 1)); | <div className="text-zinc-100"></div> |
text-zinc-200 | color: rgb(228 228 231 / var(--tw-text-opacity, 1)); | <div className="text-zinc-200"></div> |
text-zinc-300 | color: rgb(212 212 216 / var(--tw-text-opacity, 1)); | <div className="text-zinc-300"></div> |
text-zinc-400 | color: rgb(161 161 170 / var(--tw-text-opacity, 1)); | <div className="text-zinc-400"></div> |
text-zinc-500 | color: rgb(113 113 122 / var(--tw-text-opacity, 1)); | <div className="text-zinc-500"></div> |
text-zinc-600 | color: rgb(82 82 91 / var(--tw-text-opacity, 1)); | <div className="text-zinc-600"></div> |
text-zinc-700 | color: rgb(63 63 70 / var(--tw-text-opacity, 1)); | <div className="text-zinc-700"></div> |
text-zinc-800 | color: rgb(39 39 42 / var(--tw-text-opacity, 1)); | <div className="text-zinc-800"></div> |
text-zinc-900 | color: rgb(24 24 27 / var(--tw-text-opacity, 1)); | <div className="text-zinc-900"></div> |
text-zinc-950 | color: rgb(9 9 11 / var(--tw-text-opacity, 1)); | <div className="text-zinc-950"></div> |
text-neutral-50 | color: rgb(250 250 250 / var(--tw-text-opacity, 1)); | <div className="text-neutral-50"></div> |
text-neutral-100 | color: rgb(245 245 245 / var(--tw-text-opacity, 1)); | <div className="text-neutral-100"></div> |
text-neutral-200 | color: rgb(229 229 229 / var(--tw-text-opacity, 1)); | <div className="text-neutral-200"></div> |
text-neutral-300 | color: rgb(212 212 212 / var(--tw-text-opacity, 1)); | <div className="text-neutral-300"></div> |
text-neutral-400 | color: rgb(163 163 163 / var(--tw-text-opacity, 1)); | <div className="text-neutral-400"></div> |
text-neutral-500 | color: rgb(115 115 115 / var(--tw-text-opacity, 1)); | <div className="text-neutral-500"></div> |
text-neutral-600 | color: rgb(82 82 82 / var(--tw-text-opacity, 1)); | <div className="text-neutral-600"></div> |
text-neutral-700 | color: rgb(64 64 64 / var(--tw-text-opacity, 1)); | <div className="text-neutral-700"></div> |
text-neutral-800 | color: rgb(38 38 38 / var(--tw-text-opacity, 1)); | <div className="text-neutral-800"></div> |
text-neutral-900 | color: rgb(23 23 23 / var(--tw-text-opacity, 1)); | <div className="text-neutral-900"></div> |
text-neutral-950 | color: rgb(10 10 10 / var(--tw-text-opacity, 1)); | <div className="text-neutral-950"></div> |
text-stone-50 | color: rgb(250 250 249 / var(--tw-text-opacity, 1)); | <div className="text-stone-50"></div> |
text-stone-100 | color: rgb(245 245 244 / var(--tw-text-opacity, 1)); | <div className="text-stone-100"></div> |
text-stone-200 | color: rgb(231 229 228 / var(--tw-text-opacity, 1)); | <div className="text-stone-200"></div> |
text-stone-300 | color: rgb(214 211 209 / var(--tw-text-opacity, 1)); | <div className="text-stone-300"></div> |
text-stone-400 | color: rgb(168 162 158 / var(--tw-text-opacity, 1)); | <div className="text-stone-400"></div> |
text-stone-500 | color: rgb(120 113 108 / var(--tw-text-opacity, 1)); | <div className="text-stone-500"></div> |
text-stone-600 | color: rgb(87 83 78 / var(--tw-text-opacity, 1)); | <div className="text-stone-600"></div> |
text-stone-700 | color: rgb(68 64 60 / var(--tw-text-opacity, 1)); | <div className="text-stone-700"></div> |
text-stone-800 | color: rgb(41 37 36 / var(--tw-text-opacity, 1)); | <div className="text-stone-800"></div> |
text-stone-900 | color: rgb(28 25 23 / var(--tw-text-opacity, 1)); | <div className="text-stone-900"></div> |
text-stone-950 | color: rgb(12 10 9 / var(--tw-text-opacity, 1)); | <div className="text-stone-950"></div> |
text-red-50 | color: rgb(254 242 242 / var(--tw-text-opacity, 1)); | <div className="text-red-50"></div> |
text-red-100 | color: rgb(254 226 226 / var(--tw-text-opacity, 1)); | <div className="text-red-100"></div> |
text-red-200 | color: rgb(254 202 202 / var(--tw-text-opacity, 1)); | <div className="text-red-200"></div> |
text-red-300 | color: rgb(252 165 165 / var(--tw-text-opacity, 1)); | <div className="text-red-300"></div> |
text-red-400 | color: rgb(248 113 113 / var(--tw-text-opacity, 1)); | <div className="text-red-400"></div> |
text-red-500 | color: rgb(239 68 68 / var(--tw-text-opacity, 1)); | <div className="text-red-500"></div> |
text-red-600 | color: rgb(220 38 38 / var(--tw-text-opacity, 1)); | <div className="text-red-600"></div> |
text-red-700 | color: rgb(185 28 28 / var(--tw-text-opacity, 1)); | <div className="text-red-700"></div> |
text-red-800 | color: rgb(153 27 27 / var(--tw-text-opacity, 1)); | <div className="text-red-800"></div> |
text-red-900 | color: rgb(127 29 29 / var(--tw-text-opacity, 1)); | <div className="text-red-900"></div> |
text-red-950 | color: rgb(69 10 10 / var(--tw-text-opacity, 1)); | <div className="text-red-950"></div> |
text-orange-50 | color: rgb(255 247 237 / var(--tw-text-opacity, 1)); | <div className="text-orange-50"></div> |
text-orange-100 | color: rgb(255 237 213 / var(--tw-text-opacity, 1)); | <div className="text-orange-100"></div> |
text-orange-200 | color: rgb(254 215 170 / var(--tw-text-opacity, 1)); | <div className="text-orange-200"></div> |
text-orange-300 | color: rgb(253 186 116 / var(--tw-text-opacity, 1)); | <div className="text-orange-300"></div> |
text-orange-400 | color: rgb(251 146 60 / var(--tw-text-opacity, 1)); | <div className="text-orange-400"></div> |
text-orange-500 | color: rgb(249 115 22 / var(--tw-text-opacity, 1)); | <div className="text-orange-500"></div> |
text-orange-600 | color: rgb(234 88 12 / var(--tw-text-opacity, 1)); | <div className="text-orange-600"></div> |
text-orange-700 | color: rgb(194 65 12 / var(--tw-text-opacity, 1)); | <div className="text-orange-700"></div> |
text-orange-800 | color: rgb(154 52 18 / var(--tw-text-opacity, 1)); | <div className="text-orange-800"></div> |
text-orange-900 | color: rgb(124 45 18 / var(--tw-text-opacity, 1)); | <div className="text-orange-900"></div> |
text-orange-950 | color: rgb(67 20 7 / var(--tw-text-opacity, 1)); | <div className="text-orange-950"></div> |
text-amber-50 | color: rgb(255 251 235 / var(--tw-text-opacity, 1)); | <div className="text-amber-50"></div> |
text-amber-100 | color: rgb(254 243 199 / var(--tw-text-opacity, 1)); | <div className="text-amber-100"></div> |
text-amber-200 | color: rgb(253 230 138 / var(--tw-text-opacity, 1)); | <div className="text-amber-200"></div> |
text-amber-300 | color: rgb(252 211 77 / var(--tw-text-opacity, 1)); | <div className="text-amber-300"></div> |
text-amber-400 | color: rgb(251 191 36 / var(--tw-text-opacity, 1)); | <div className="text-amber-400"></div> |
text-amber-500 | color: rgb(245 158 11 / var(--tw-text-opacity, 1)); | <div className="text-amber-500"></div> |
text-amber-600 | color: rgb(217 119 6 / var(--tw-text-opacity, 1)); | <div className="text-amber-600"></div> |
text-amber-700 | color: rgb(180 83 9 / var(--tw-text-opacity, 1)); | <div className="text-amber-700"></div> |
text-amber-800 | color: rgb(146 64 14 / var(--tw-text-opacity, 1)); | <div className="text-amber-800"></div> |
text-amber-900 | color: rgb(120 53 15 / var(--tw-text-opacity, 1)); | <div className="text-amber-900"></div> |
text-amber-950 | color: rgb(69 26 3 / var(--tw-text-opacity, 1)); | <div className="text-amber-950"></div> |
text-yellow-50 | color: rgb(254 252 232 / var(--tw-text-opacity, 1)); | <div className="text-yellow-50"></div> |
text-yellow-100 | color: rgb(254 249 195 / var(--tw-text-opacity, 1)); | <div className="text-yellow-100"></div> |
text-yellow-200 | color: rgb(254 240 138 / var(--tw-text-opacity, 1)); | <div className="text-yellow-200"></div> |
text-yellow-300 | color: rgb(253 224 71 / var(--tw-text-opacity, 1)); | <div className="text-yellow-300"></div> |
text-yellow-400 | color: rgb(250 204 21 / var(--tw-text-opacity, 1)); | <div className="text-yellow-400"></div> |
text-yellow-500 | color: rgb(234 179 8 / var(--tw-text-opacity, 1)); | <div className="text-yellow-500"></div> |
text-yellow-600 | color: rgb(202 138 4 / var(--tw-text-opacity, 1)); | <div className="text-yellow-600"></div> |
text-yellow-700 | color: rgb(161 98 7 / var(--tw-text-opacity, 1)); | <div className="text-yellow-700"></div> |
text-yellow-800 | color: rgb(133 77 14 / var(--tw-text-opacity, 1)); | <div className="text-yellow-800"></div> |
text-yellow-900 | color: rgb(113 63 18 / var(--tw-text-opacity, 1)); | <div className="text-yellow-900"></div> |
text-yellow-950 | color: rgb(66 32 6 / var(--tw-text-opacity, 1)); | <div className="text-yellow-950"></div> |
text-lime-50 | color: rgb(247 254 231 / var(--tw-text-opacity, 1)); | <div className="text-lime-50"></div> |
text-lime-100 | color: rgb(236 252 203 / var(--tw-text-opacity, 1)); | <div className="text-lime-100"></div> |
text-lime-200 | color: rgb(217 249 157 / var(--tw-text-opacity, 1)); | <div className="text-lime-200"></div> |
text-lime-300 | color: rgb(190 242 100 / var(--tw-text-opacity, 1)); | <div className="text-lime-300"></div> |
text-lime-400 | color: rgb(163 230 53 / var(--tw-text-opacity, 1)); | <div className="text-lime-400"></div> |
text-lime-500 | color: rgb(132 204 22 / var(--tw-text-opacity, 1)); | <div className="text-lime-500"></div> |
text-lime-600 | color: rgb(101 163 13 / var(--tw-text-opacity, 1)); | <div className="text-lime-600"></div> |
text-lime-700 | color: rgb(77 124 15 / var(--tw-text-opacity, 1)); | <div className="text-lime-700"></div> |
text-lime-800 | color: rgb(63 98 18 / var(--tw-text-opacity, 1)); | <div className="text-lime-800"></div> |
text-lime-900 | color: rgb(54 83 20 / var(--tw-text-opacity, 1)); | <div className="text-lime-900"></div> |
text-lime-950 | color: rgb(26 46 5 / var(--tw-text-opacity, 1)); | <div className="text-lime-950"></div> |
text-green-50 | color: rgb(240 253 244 / var(--tw-text-opacity, 1)); | <div className="text-green-50"></div> |
text-green-100 | color: rgb(220 252 231 / var(--tw-text-opacity, 1)); | <div className="text-green-100"></div> |
text-green-200 | color: rgb(187 247 208 / var(--tw-text-opacity, 1)); | <div className="text-green-200"></div> |
text-green-300 | color: rgb(134 239 172 / var(--tw-text-opacity, 1)); | <div className="text-green-300"></div> |
text-green-400 | color: rgb(74 222 128 / var(--tw-text-opacity, 1)); | <div className="text-green-400"></div> |
text-green-500 | color: rgb(34 197 94 / var(--tw-text-opacity, 1)); | <div className="text-green-500"></div> |
text-green-600 | color: rgb(22 163 74 / var(--tw-text-opacity, 1)); | <div className="text-green-600"></div> |
text-green-700 | color: rgb(21 128 61 / var(--tw-text-opacity, 1)); | <div className="text-green-700"></div> |
text-green-800 | color: rgb(22 101 52 / var(--tw-text-opacity, 1)); | <div className="text-green-800"></div> |
text-green-900 | color: rgb(20 83 45 / var(--tw-text-opacity, 1)); | <div className="text-green-900"></div> |
text-green-950 | color: rgb(5 46 22 / var(--tw-text-opacity, 1)); | <div className="text-green-950"></div> |
text-emerald-50 | color: rgb(236 253 245 / var(--tw-text-opacity, 1)); | <div className="text-emerald-50"></div> |
text-emerald-100 | color: rgb(209 250 229 / var(--tw-text-opacity, 1)); | <div className="text-emerald-100"></div> |
text-emerald-200 | color: rgb(167 243 208 / var(--tw-text-opacity, 1)); | <div className="text-emerald-200"></div> |
text-emerald-300 | color: rgb(110 231 183 / var(--tw-text-opacity, 1)); | <div className="text-emerald-300"></div> |
text-emerald-400 | color: rgb(52 211 153 / var(--tw-text-opacity, 1)); | <div className="text-emerald-400"></div> |
text-emerald-500 | color: rgb(16 185 129 / var(--tw-text-opacity, 1)); | <div className="text-emerald-500"></div> |
text-emerald-600 | color: rgb(5 150 105 / var(--tw-text-opacity, 1)); | <div className="text-emerald-600"></div> |
text-emerald-700 | color: rgb(4 120 87 / var(--tw-text-opacity, 1)); | <div className="text-emerald-700"></div> |
text-emerald-800 | color: rgb(6 95 70 / var(--tw-text-opacity, 1)); | <div className="text-emerald-800"></div> |
text-emerald-900 | color: rgb(6 78 59 / var(--tw-text-opacity, 1)); | <div className="text-emerald-900"></div> |
text-emerald-950 | color: rgb(2 44 34 / var(--tw-text-opacity, 1)); | <div className="text-emerald-950"></div> |
text-teal-50 | color: rgb(240 253 250 / var(--tw-text-opacity, 1)); | <div className="text-teal-50"></div> |
text-teal-100 | color: rgb(204 251 241 / var(--tw-text-opacity, 1)); | <div className="text-teal-100"></div> |
text-teal-200 | color: rgb(153 246 228 / var(--tw-text-opacity, 1)); | <div className="text-teal-200"></div> |
text-teal-300 | color: rgb(94 234 212 / var(--tw-text-opacity, 1)); | <div className="text-teal-300"></div> |
text-teal-400 | color: rgb(45 212 191 / var(--tw-text-opacity, 1)); | <div className="text-teal-400"></div> |
text-teal-500 | color: rgb(20 184 166 / var(--tw-text-opacity, 1)); | <div className="text-teal-500"></div> |
text-teal-600 | color: rgb(13 148 136 / var(--tw-text-opacity, 1)); | <div className="text-teal-600"></div> |
text-teal-700 | color: rgb(15 118 110 / var(--tw-text-opacity, 1)); | <div className="text-teal-700"></div> |
text-teal-800 | color: rgb(17 94 89 / var(--tw-text-opacity, 1)); | <div className="text-teal-800"></div> |
text-teal-900 | color: rgb(19 78 74 / var(--tw-text-opacity, 1)); | <div className="text-teal-900"></div> |
text-teal-950 | color: rgb(4 47 46 / var(--tw-text-opacity, 1)); | <div className="text-teal-950"></div> |
text-cyan-50 | color: rgb(236 254 255 / var(--tw-text-opacity, 1)); | <div className="text-cyan-50"></div> |
text-cyan-100 | color: rgb(207 250 254 / var(--tw-text-opacity, 1)); | <div className="text-cyan-100"></div> |
text-cyan-200 | color: rgb(165 243 252 / var(--tw-text-opacity, 1)); | <div className="text-cyan-200"></div> |
text-cyan-300 | color: rgb(103 232 249 / var(--tw-text-opacity, 1)); | <div className="text-cyan-300"></div> |
text-cyan-400 | color: rgb(34 211 238 / var(--tw-text-opacity, 1)); | <div className="text-cyan-400"></div> |
text-cyan-500 | color: rgb(6 182 212 / var(--tw-text-opacity, 1)); | <div className="text-cyan-500"></div> |
text-cyan-600 | color: rgb(8 145 178 / var(--tw-text-opacity, 1)); | <div className="text-cyan-600"></div> |
text-cyan-700 | color: rgb(14 116 144 / var(--tw-text-opacity, 1)); | <div className="text-cyan-700"></div> |
text-cyan-800 | color: rgb(21 94 117 / var(--tw-text-opacity, 1)); | <div className="text-cyan-800"></div> |
text-cyan-900 | color: rgb(22 78 99 / var(--tw-text-opacity, 1)); | <div className="text-cyan-900"></div> |
text-cyan-950 | color: rgb(8 51 68 / var(--tw-text-opacity, 1)); | <div className="text-cyan-950"></div> |
text-sky-50 | color: rgb(240 249 255 / var(--tw-text-opacity, 1)); | <div className="text-sky-50"></div> |
text-sky-100 | color: rgb(224 242 254 / var(--tw-text-opacity, 1)); | <div className="text-sky-100"></div> |
text-sky-200 | color: rgb(186 230 253 / var(--tw-text-opacity, 1)); | <div className="text-sky-200"></div> |
text-sky-300 | color: rgb(125 211 252 / var(--tw-text-opacity, 1)); | <div className="text-sky-300"></div> |
text-sky-400 | color: rgb(56 189 248 / var(--tw-text-opacity, 1)); | <div className="text-sky-400"></div> |
text-sky-500 | color: rgb(14 165 233 / var(--tw-text-opacity, 1)); | <div className="text-sky-500"></div> |
text-sky-600 | color: rgb(2 132 199 / var(--tw-text-opacity, 1)); | <div className="text-sky-600"></div> |
text-sky-700 | color: rgb(3 105 161 / var(--tw-text-opacity, 1)); | <div className="text-sky-700"></div> |
text-sky-800 | color: rgb(7 89 133 / var(--tw-text-opacity, 1)); | <div className="text-sky-800"></div> |
text-sky-900 | color: rgb(12 74 110 / var(--tw-text-opacity, 1)); | <div className="text-sky-900"></div> |
text-sky-950 | color: rgb(8 47 73 / var(--tw-text-opacity, 1)); | <div className="text-sky-950"></div> |
text-blue-50 | color: rgb(239 246 255 / var(--tw-text-opacity, 1)); | <div className="text-blue-50"></div> |
text-blue-100 | color: rgb(219 234 254 / var(--tw-text-opacity, 1)); | <div className="text-blue-100"></div> |
text-blue-200 | color: rgb(191 219 254 / var(--tw-text-opacity, 1)); | <div className="text-blue-200"></div> |
text-blue-300 | color: rgb(147 197 253 / var(--tw-text-opacity, 1)); | <div className="text-blue-300"></div> |
text-blue-400 | color: rgb(96 165 250 / var(--tw-text-opacity, 1)); | <div className="text-blue-400"></div> |
text-blue-500 | color: rgb(59 130 246 / var(--tw-text-opacity, 1)); | <div className="text-blue-500"></div> |
text-blue-600 | color: rgb(37 99 235 / var(--tw-text-opacity, 1)); | <div className="text-blue-600"></div> |
text-blue-700 | color: rgb(29 78 216 / var(--tw-text-opacity, 1)); | <div className="text-blue-700"></div> |
text-blue-800 | color: rgb(30 64 175 / var(--tw-text-opacity, 1)); | <div className="text-blue-800"></div> |
text-blue-900 | color: rgb(30 58 138 / var(--tw-text-opacity, 1)); | <div className="text-blue-900"></div> |
text-blue-950 | color: rgb(23 37 84 / var(--tw-text-opacity, 1)); | <div className="text-blue-950"></div> |
text-indigo-50 | color: rgb(238 242 255 / var(--tw-text-opacity, 1)); | <div className="text-indigo-50"></div> |
text-indigo-100 | color: rgb(224 231 255 / var(--tw-text-opacity, 1)); | <div className="text-indigo-100"></div> |
text-indigo-200 | color: rgb(199 210 254 / var(--tw-text-opacity, 1)); | <div className="text-indigo-200"></div> |
text-indigo-300 | color: rgb(165 180 252 / var(--tw-text-opacity, 1)); | <div className="text-indigo-300"></div> |
text-indigo-400 | color: rgb(129 140 248 / var(--tw-text-opacity, 1)); | <div className="text-indigo-400"></div> |
text-indigo-500 | color: rgb(99 102 241 / var(--tw-text-opacity, 1)); | <div className="text-indigo-500"></div> |
text-indigo-600 | color: rgb(79 70 229 / var(--tw-text-opacity, 1)); | <div className="text-indigo-600"></div> |
text-indigo-700 | color: rgb(67 56 202 / var(--tw-text-opacity, 1)); | <div className="text-indigo-700"></div> |
text-indigo-800 | color: rgb(55 48 163 / var(--tw-text-opacity, 1)); | <div className="text-indigo-800"></div> |
text-indigo-900 | color: rgb(49 46 129 / var(--tw-text-opacity, 1)); | <div className="text-indigo-900"></div> |
text-indigo-950 | color: rgb(30 27 75 / var(--tw-text-opacity, 1)); | <div className="text-indigo-950"></div> |
text-violet-50 | color: rgb(245 243 255 / var(--tw-text-opacity, 1)); | <div className="text-violet-50"></div> |
text-violet-100 | color: rgb(237 233 254 / var(--tw-text-opacity, 1)); | <div className="text-violet-100"></div> |
text-violet-200 | color: rgb(221 214 254 / var(--tw-text-opacity, 1)); | <div className="text-violet-200"></div> |
text-violet-300 | color: rgb(196 181 253 / var(--tw-text-opacity, 1)); | <div className="text-violet-300"></div> |
text-violet-400 | color: rgb(167 139 250 / var(--tw-text-opacity, 1)); | <div className="text-violet-400"></div> |
text-violet-500 | color: rgb(139 92 246 / var(--tw-text-opacity, 1)); | <div className="text-violet-500"></div> |
text-violet-600 | color: rgb(124 58 237 / var(--tw-text-opacity, 1)); | <div className="text-violet-600"></div> |
text-violet-700 | color: rgb(109 40 217 / var(--tw-text-opacity, 1)); | <div className="text-violet-700"></div> |
text-violet-800 | color: rgb(91 33 182 / var(--tw-text-opacity, 1)); | <div className="text-violet-800"></div> |
text-violet-900 | color: rgb(76 29 149 / var(--tw-text-opacity, 1)); | <div className="text-violet-900"></div> |
text-violet-950 | color: rgb(46 16 101 / var(--tw-text-opacity, 1)); | <div className="text-violet-950"></div> |
text-purple-50 | color: rgb(250 245 255 / var(--tw-text-opacity, 1)); | <div className="text-purple-50"></div> |
text-purple-100 | color: rgb(243 232 255 / var(--tw-text-opacity, 1)); | <div className="text-purple-100"></div> |
text-purple-200 | color: rgb(233 213 255 / var(--tw-text-opacity, 1)); | <div className="text-purple-200"></div> |
text-purple-300 | color: rgb(216 180 254 / var(--tw-text-opacity, 1)); | <div className="text-purple-300"></div> |
text-purple-400 | color: rgb(192 132 252 / var(--tw-text-opacity, 1)); | <div className="text-purple-400"></div> |
text-purple-500 | color: rgb(168 85 247 / var(--tw-text-opacity, 1)); | <div className="text-purple-500"></div> |
text-purple-600 | color: rgb(147 51 234 / var(--tw-text-opacity, 1)); | <div className="text-purple-600"></div> |
text-purple-700 | color: rgb(126 34 206 / var(--tw-text-opacity, 1)); | <div className="text-purple-700"></div> |
text-purple-800 | color: rgb(107 33 168 / var(--tw-text-opacity, 1)); | <div className="text-purple-800"></div> |
text-purple-900 | color: rgb(88 28 135 / var(--tw-text-opacity, 1)); | <div className="text-purple-900"></div> |
text-purple-950 | color: rgb(59 7 100 / var(--tw-text-opacity, 1)); | <div className="text-purple-950"></div> |
text-fuchsia-50 | color: rgb(253 244 255 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-50"></div> |
text-fuchsia-100 | color: rgb(250 232 255 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-100"></div> |
text-fuchsia-200 | color: rgb(245 208 254 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-200"></div> |
text-fuchsia-300 | color: rgb(240 171 252 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-300"></div> |
text-fuchsia-400 | color: rgb(232 121 249 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-400"></div> |
text-fuchsia-500 | color: rgb(217 70 239 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-500"></div> |
text-fuchsia-600 | color: rgb(192 38 211 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-600"></div> |
text-fuchsia-700 | color: rgb(162 28 175 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-700"></div> |
text-fuchsia-800 | color: rgb(134 25 143 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-800"></div> |
text-fuchsia-900 | color: rgb(112 26 117 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-900"></div> |
text-fuchsia-950 | color: rgb(74 4 78 / var(--tw-text-opacity, 1)); | <div className="text-fuchsia-950"></div> |
text-pink-50 | color: rgb(253 242 248 / var(--tw-text-opacity, 1)); | <div className="text-pink-50"></div> |
text-pink-100 | color: rgb(252 231 243 / var(--tw-text-opacity, 1)); | <div className="text-pink-100"></div> |
text-pink-200 | color: rgb(251 207 232 / var(--tw-text-opacity, 1)); | <div className="text-pink-200"></div> |
text-pink-300 | color: rgb(249 168 212 / var(--tw-text-opacity, 1)); | <div className="text-pink-300"></div> |
text-pink-400 | color: rgb(244 114 182 / var(--tw-text-opacity, 1)); | <div className="text-pink-400"></div> |
text-pink-500 | color: rgb(236 72 153 / var(--tw-text-opacity, 1)); | <div className="text-pink-500"></div> |
text-pink-600 | color: rgb(219 39 119 / var(--tw-text-opacity, 1)); | <div className="text-pink-600"></div> |
text-pink-700 | color: rgb(190 24 93 / var(--tw-text-opacity, 1)); | <div className="text-pink-700"></div> |
text-pink-800 | color: rgb(157 23 77 / var(--tw-text-opacity, 1)); | <div className="text-pink-800"></div> |
text-pink-900 | color: rgb(131 24 67 / var(--tw-text-opacity, 1)); | <div className="text-pink-900"></div> |
text-pink-950 | color: rgb(80 7 36 / var(--tw-text-opacity, 1)); | <div className="text-pink-950"></div> |
text-rose-50 | color: rgb(255 241 242 / var(--tw-text-opacity, 1)); | <div className="text-rose-50"></div> |
text-rose-100 | color: rgb(255 228 230 / var(--tw-text-opacity, 1)); | <div className="text-rose-100"></div> |
text-rose-200 | color: rgb(254 205 211 / var(--tw-text-opacity, 1)); | <div className="text-rose-200"></div> |
text-rose-300 | color: rgb(253 164 175 / var(--tw-text-opacity, 1)); | <div className="text-rose-300"></div> |
text-rose-400 | color: rgb(251 113 133 / var(--tw-text-opacity, 1)); | <div className="text-rose-400"></div> |
text-rose-500 | color: rgb(244 63 94 / var(--tw-text-opacity, 1)); | <div className="text-rose-500"></div> |
text-rose-600 | color: rgb(225 29 72 / var(--tw-text-opacity, 1)); | <div className="text-rose-600"></div> |
text-rose-700 | color: rgb(190 18 60 / var(--tw-text-opacity, 1)); | <div className="text-rose-700"></div> |
text-rose-800 | color: rgb(159 18 57 / var(--tw-text-opacity, 1)); | <div className="text-rose-800"></div> |
text-rose-900 | color: rgb(136 19 55 / var(--tw-text-opacity, 1)); | <div className="text-rose-900"></div> |
text-rose-950 | color: rgb(76 5 25 / var(--tw-text-opacity, 1)); | <div className="text-rose-950"></div> |
Overview of Text Color
Adding the Text Color
You can define text colors quickly using Tailwind's predefined text-*
classes. Here’s an example of applying text-red-600
to your components:
export default function RedTextComponent() { return ( <div className="w-screen h-screen bg-gray-50 flex justify-center items-center"> {/* Set text color to red */} <h1 className="text-red-600 text-4xl font-bold"> Danger Notice! </h1> </div> ); }
The class text-red-600
applies a red hue (#dc2626). Other color intensities (e.g., 100–900) offer varying saturation levels for the same shade.
Adjusting the Opacity
Sometimes, opacity controls are necessary for styling. Tailwind provides opacity modifiers to adjust transparency. For instance, setting your text to semi-transparent:
export default function TransparentText() { return ( <div className="w-screen h-screen bg-gray-800 flex justify-center items-center"> {/* Set white text with 60% opacity */} <p className="text-white/60 text-xl"> Semi-transparent message </p> </div> ); }
By using text-white/60
, the text in this snippet is white with an opacity of 60%. You can combine any color with specific opacities (e.g., 50%
, 30%
, etc.).
States and Responsiveness
Hover and Focus States
Tailwind supports pseudo-classes like hover
and focus
for interactive visual states. For example, make the text change color on hover:
export default function HoverAndFocusStyles() { return ( <div className="w-screen h-screen bg-indigo-100 flex justify-center items-center"> <button tabindex="0" className="text-blue-600 hover:text-blue-800 focus:text-blue-900 text-lg font-medium"> Hover or Focus Me! </button> </div> ); }
text-blue-600
applies a base color.hover:text-blue-800
intensifies this effect when the user hovers.focus:text-blue-900
makes it even darker while focusing.
Breakpoint Modifiers
Responsive designs often need variations based on screen size. Tailwind assigns breakpoint-modifiers for customizing colors. For instance:
export default function ResponsiveText() { return ( <div className="w-screen h-screen bg-yellow-100 flex flex-col gap-5 justify-center items-center"> {/* Neutral default */} <h2 className="text-gray-600 md:text-green-600 lg:text-orange-600 text-center text-lg px-10"> Watch me change on larger screens! </h2> </div> ); }
- Base (small screens): Gray text with
text-gray-600
. - Medium devices (≥768px): A subtle green using
md:text-green-600
. - Large devices (≥1024px): Highlights in vibrant orange (
lg:text-orange-600
).
Custom Text Color
Extending the Theme
When default palettes don’t suffice, define additional colors in your project’s tailwind.config.js
. Tailwind merges your brand
color variants alongside existing palettes, providing scalable consistency.
Let’s add a custom brand shade:
import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; export default function CustomBrandColor() { return ( <div className="w-screen h-screen bg-brand-200 flex items-center justify-center"> <h1 className="text-brand-600 text-3xl font-semibold"> This is our brand </h1> </div> ); }
Using Arbitrary Values
For non-standard requirements (unlisted colors or specific use cases), arbitrary values come in handy. Combine precise CSS values (Hex, RGB, or HSL) without defining them in config:
In the below example, the class text-[rgb(34,139,34)]
applies an RGB-defined ForestGreen (#228B22) color:
export default function ArbitraryStyledText() { return ( <div className="w-screen h-screen bg-gray-300 flex items-center justify-center"> <p className="text-[rgb(34,139,34)] text-2xl"> Custom RGB Text Color </p> </div> ); }
Real World Examples
Dynamic Price Range Indicator
This component displays product prices with different text colors based on price ranges. Perfect for e-commerce dashboards.
export default function PriceRangeIndicator() { const products = [ { id: 1, name: "Premium Headphones", price: 299.99 }, { id: 2, name: "Wireless Mouse", price: 49.99 }, { id: 3, name: "Mechanical Keyboard", price: 159.99 }, { id: 4, name: "4K Monitor", price: 699.99 }, { id: 5, name: "Gaming Chair", price: 249.99 }, { id: 6, name: "USB-C Hub", price: 79.99 } ]; const getPriceColor = (price) => { if (price < 50) return "text-green-600"; if (price < 200) return "text-blue-600"; if (price < 500) return "text-purple-600"; return "text-red-600"; }; return ( <div className="space-y-4 p-6 bg-gray-50"> <h2 className="text-2xl font-bold text-gray-800">Product Pricing</h2> {products.map((product) => ( <div key={product.id} className="flex justify-between items-center border-b pb-2"> <span className="text-gray-700">{product.name}</span> <span className={`font-semibold ${getPriceColor(product.price)}`}> ${product.price} </span> </div> ))} </div> ); }
Status Message Display
A component that shows different types of status messages with appropriate text colors.
export default function StatusMessages() { const messages = [ { id: 1, type: "success", message: "Payment processed successfully", timestamp: "2 min ago" }, { id: 2, type: "error", message: "Failed to upload file", timestamp: "5 min ago" }, { id: 3, type: "warning", message: "Low storage space remaining", timestamp: "10 min ago" }, { id: 4, type: "info", message: "System maintenance scheduled", timestamp: "15 min ago" }, { id: 5, type: "success", message: "Profile updated successfully", timestamp: "20 min ago" }, { id: 6, type: "error", message: "Connection timeout error", timestamp: "25 min ago" } ]; const getMessageColor = (type) => { const colors = { success: "text-emerald-600", error: "text-rose-600", warning: "text-amber-600", info: "text-sky-600" }; return colors[type]; }; return ( <div className="max-w-2xl mx-auto p-6"> <h2 className="text-xl font-bold text-gray-800 mb-4">System Messages</h2> <div className="space-y-3"> {messages.map((msg) => ( <div key={msg.id} className="flex items-center justify-between bg-white p-4 rounded-lg shadow-sm"> <span className={`${getMessageColor(msg.type)}`}>{msg.message}</span> <span className="text-gray-400 text-sm">{msg.timestamp}</span> </div> ))} </div> </div> ); }
Temperature Display Widget
A component that changes text color based on temperature values.
export default function TemperatureWidget() { const readings = [ { id: 1, location: "Living Room", temp: 72, humidity: 45 }, { id: 2, location: "Kitchen", temp: 76, humidity: 52 }, { id: 3, location: "Bedroom", temp: 68, humidity: 40 }, { id: 4, location: "Basement", temp: 65, humidity: 60 }, { id: 5, location: "Garage", temp: 82, humidity: 35 }, { id: 6, location: "Attic", temp: 85, humidity: 30 } ]; const getTempColor = (temp) => { if (temp < 68) return "text-blue-600"; if (temp < 74) return "text-green-600"; if (temp < 80) return "text-yellow-600"; return "text-red-600"; }; return ( <div className="bg-white p-6 rounded-xl shadow-lg"> <h2 className="text-2xl font-bold text-gray-800 mb-6">Home Temperature Monitor</h2> <div className="grid grid-cols-2 gap-4"> {readings.map((reading) => ( <div key={reading.id} className="bg-gray-50 p-4 rounded-lg"> <h3 className="text-gray-700 font-medium">{reading.location}</h3> <div className="mt-2 flex justify-between items-center"> <span className={`text-2xl font-bold ${getTempColor(reading.temp)}`}> {reading.temp}°F </span> <span className="text-gray-500">{reading.humidity}% Humidity</span> </div> </div> ))} </div> </div> ); }
Stock Market Ticker
A component that displays stock prices with color-coded changes.
export default function StockTicker() { const stocks = [ { id: 1, symbol: "AAPL", price: 150.25, change: +2.5 }, { id: 2, symbol: "GOOGL", price: 2750.80, change: -1.2 }, { id: 3, symbol: "MSFT", price: 310.45, change: +1.8 }, { id: 4, symbol: "AMZN", price: 3300.75, change: -0.5 }, { id: 5, symbol: "TSLA", price: 875.90, change: +3.2 }, { id: 6, symbol: "META", price: 330.15, change: -2.1 } ]; return ( <div className="bg-gray-900 p-6 rounded-lg"> <h2 className="text-white text-xl font-bold mb-4">Market Watch</h2> <div className="grid grid-cols-1 gap-3"> {stocks.map((stock) => ( <div key={stock.id} className="flex items-center justify-between bg-gray-800 p-3 rounded"> <span className="text-gray-100 font-medium">{stock.symbol}</span> <div className="flex items-center space-x-4"> <span className="text-gray-200">${stock.price}</span> <span className={`${stock.change >= 0 ? 'text-green-400' : 'text-red-400'}`}> {stock.change >= 0 ? '+' : ''}{stock.change}% </span> </div> </div> ))} </div> </div> ); }
Task Priority List
A component that displays tasks with color-coded priority levels.
export default function TaskPriority() { const tasks = [ { id: 1, title: "Update security patches", priority: "critical", dueDate: "Today" }, { id: 2, title: "Review pull requests", priority: "high", dueDate: "Tomorrow" }, { id: 3, title: "Write documentation", priority: "medium", dueDate: "Next Week" }, { id: 4, title: "Team meeting", priority: "low", dueDate: "Today" }, { id: 5, title: "Deploy to production", priority: "critical", dueDate: "Today" }, { id: 6, title: "Code review", priority: "high", dueDate: "Tomorrow" } ]; const getPriorityColor = (priority) => { const colors = { critical: "text-red-600 font-bold", high: "text-orange-600 font-semibold", medium: "text-yellow-600", low: "text-blue-600" }; return colors[priority]; }; return ( <div className="max-w-2xl mx-auto p-6 bg-white rounded-xl shadow-lg"> <h2 className="text-2xl font-bold text-gray-800 mb-6">Task Manager</h2> <div className="space-y-4"> {tasks.map((task) => ( <div key={task.id} className="flex items-center justify-between p-4 bg-gray-50 rounded-lg"> <div className="flex-1"> <h3 className="text-gray-800 font-medium">{task.title}</h3> <span className={`text-sm ${getPriorityColor(task.priority)}`}> {task.priority.toUpperCase()} </span> </div> <span className="text-gray-500 text-sm">{task.dueDate}</span> </div> ))} </div> </div> ); }
Customization Examples
Gradient Text Effect for Product Pricing
This example demonstrates how to create a custom gradient text color effect for a premium pricing display.
// App.js import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; export default function PricingDisplay() { return ( <div className="min-h-screen bg-gray-900 flex items-center justify-center"> <div className="text-center space-y-4"> <h2 className="text-white text-2xl font-bold">Premium Plan</h2> <div className="relative"> <span className="text-7xl font-extrabold bg-gradient-to-r from-premium-start to-premium-end bg-clip-text text-transparent"> $99 </span> <span className="text-premium-end text-2xl font-bold">/month</span> </div> <p className="text-gray-400 max-w-md"> Access all premium features with our enterprise solution </p> </div> </div> ) }
Dynamic Text Color for Dark/Light Theme Toggle
This example shows how to implement custom text colors that respond to theme changes.
// App.js import { useState } from "react"; import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; export default function ThemeToggleCard() { const [isDark, setIsDark] = useState(false) return ( <div className={`min-h-screen p-8 ${isDark ? 'bg-gray-900' : 'bg-gray-100'}`} style={{ '--text-primary': isDark ? '#E5E7EB' : '#1F2937', '--text-secondary': isDark ? '#9CA3AF' : '#4B5563' }} > <div className="max-w-md mx-auto bg-white/10 backdrop-blur-lg rounded-xl p-6"> <div className="flex justify-between items-center mb-6"> <h2 className="text-theme-text-primary text-xl font-bold"> Theme Settings </h2> <button onClick={() => setIsDark(!isDark)} className="px-4 py-2 rounded-lg bg-blue-500 text-white" > Toggle Theme </button> </div> <p className="text-theme-text-secondary"> Your current theme preference is {isDark ? 'Dark' : 'Light'} mode. </p> </div> </div> ) }
Interactive Status Message Text Colors
This example demonstrates custom text colors for different status messages with hover states.
// App.js import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; export default function StatusMessages() { return ( <div className="min-h-screen bg-gray-50 p-8"> <div className="max-w-lg mx-auto space-y-6"> <div className="bg-white rounded-lg shadow-md p-6"> <h2 className="text-xl font-bold mb-4">System Status</h2> <div className="space-y-4"> <div className="group cursor-pointer"> <div className="flex items-center space-x-3"> <div className="w-2 h-2 rounded-full bg-status-success"></div> <p className="text-status-success group-hover:text-status-success-hover transition-colors"> Database connection established </p> </div> </div> <div className="group cursor-pointer"> <div className="flex items-center space-x-3"> <div className="w-2 h-2 rounded-full bg-status-warning"></div> <p className="text-status-warning group-hover:text-status-warning-hover transition-colors"> CPU usage at 85% </p> </div> </div> <div className="group cursor-pointer"> <div className="flex items-center space-x-3"> <div className="w-2 h-2 rounded-full bg-status-error"></div> <p className="text-status-error group-hover:text-status-error-hover transition-colors"> Memory limit reached </p> </div> </div> </div> </div> </div> </div> ) }
Best Practices
Maintain Design Consistency
Uniformity is a fundamental aspect of a professional and cohesive user experience. Using pre-defined text color utilities in Tailwind CSS ensures that your application maintains a consistent design system. Start by selecting a minimal subset of base colors from Tailwind's default palette, and apply them across all project elements. For instance, ensure headings use shades of gray (text-gray-800
) for a neutral and readable appearance, while accent colors like text-red-600
are reserved for alerts or warnings.
If your designs require brand-specific colors, add custom colors to your Tailwind configuration. For broader consistency, establish rules around their usage. For example, primary buttons might always use text-brand-500
for their label and secondary buttons text-brand-300
. By documenting these color rules and adhering to them, you create a foundation for scalable design improvements.
Consider using semantic class names in custom configurations. For instance, define classes like text-success
or text-warning
in your tailwind.config.js
. This abstraction ensures that updates to color definitions propagate seamlessly across your project, minimizing the risk of inconsistencies.
Leverage Utility Combinations
Effectively combining text color utilities with other tools makes complex designs achievable without adding unnecessary styles. For example, use gradient utilities like bg-clip-text
and text-transparent
alongside Tailwind's robust color palette when crafting stand-out text elements. Here’s how you can highlight a pricing plan with gradient text:
export default function GradientTextPricing() { return ( <div className="flex flex-col items-center min-h-screen bg-gray-200 justify-center"> <h1 className="text-5xl font-extrabold bg-gradient-to-r from-blue-500 to-purple-600 bg-clip-text text-transparent"> $99/Month </h1> <p className="text-gray-700 mt-4">Unlock premium features with our exclusive plan.</p> </div> ); }
Overlay text on media-rich backgrounds with text-shadow
, or ensure contrast by combining utilities like backdrop-blur
with thoughtfully chosen text-opacity
. Experiment strategically with Tailwind’s responsive typography utilities, like md:text-red-600
, to adapt your combinations effectively for various screen sizes.
Accessibility Considerations
Enhance Readability and Navigability
Readable text is foundational to accessible user interfaces. In Tailwind CSS, you can achieve this by leveraging color contrasts effectively. For instance, light text colors like text-white
on dark backgrounds, such as bg-gray-900
, ensure high contrast. Additionally, utilities like font-medium
reduce visual strain by subtly enhancing text weight.
Navigability can also be improved by reinforcing section headers with distinct colors, such as text-indigo-700
. Reserve functional colors like text-green-600
for success notifications and text-red-600
for errors, simplifying comprehension for users navigating dynamic content like forms or dashboards.
The scale of colors (100–900) ensures that transitions between shades, such as hover:text-blue-500
to hover:text-blue-700
, maintain accessibility while adding subtle interactivity to navigable elements. Always cross-check contrast ratios for compliance with WCAG AA/AAA standards.
Focus on High Contrast
To build universally inclusive interfaces, always evaluate text-to-background contrast ratios. Tailwind’s text color utilities make it effortless, given their alignment with accessible color values. When configuring custom colors, test them using contrast-analysis tools before production.
Here is a dark theme list component where contrast aids accessibility:
export default function HighContrastList() { return ( <div className="min-h-screen bg-gray-900 flex flex-col space-y-4 p-8"> <h1 className="text-gray-50 text-2xl font-semibold">Popular Products</h1> <ul className="text-gray-400 space-y-2"> <li className="hover:text-gray-100 transition">Wireless Headphones</li> <li className="hover:text-gray-100 transition">Smartphone Case</li> <li className="hover:text-gray-100 transition">Laptop Sleeve</li> </ul> </div> ); }
Ensure that hover or focus changes retain adequate contrast as interactive states should never undermine readability. Select text utilities that align with WCAG guidelines while testing hover and focus states independently across platforms.
Debugging Common Issues
Resolve Common Problems
Occasionally, text utilities in Tailwind CSS may conflict, causing unreadable combinations like light text on light backgrounds. These issues often arise from unintended class inheritance in nested component structures or overly generic configurations. To resolve this, inspect your component layers using browser developer tools to understand which utilities cascade or override specific class outputs.
For instance, if a class like text-gray-200
is overridden by a parent structure, enforce specificity by appending !text-gray-900
to confirm the intended impact. Tailwind also enables conditional overrides via modifier utilities like hover:text-red-600
, addressing interaction-specific inconsistencies without revisiting component designs.