Look, I'll be straight with you. When I first started using Tailwind CSS, I thought text colors would be the easiest thing ever. Just slap on a class and call it a day, right? Wrong. There's actually a ton of cool stuff you can do with text colors in Tailwind that'll make your life way easier and your projects look sick.
So let me break down everything I wish someone had told me when I started. No fluff, just the good stuff.
The Basics (Don't Skip This Part)
Tailwind's text color system is pretty straightforward. You use text-{color}-{number} where the number goes from 50 (super light) to 950 (almost black). Here's what that looks like:
Standard blue text (text-blue-500)
Slightly darker red (text-red-600)
Almost white gray (text-gray-100)
<p class="text-blue-500">Standard blue text</p>
<p class="text-red-600">Slightly darker red</p>
<p class="text-gray-900">Almost black gray</p>
The default text color in Tailwind is actually inherited from your browser's default, which is usually black. If you want to set a default for your whole project, just add it to your body or html tag:
<body class="text-gray-800">
<!-- Everything inherits this unless you override it -->
</body>
6 Game-Changing Tips I Use Every Day
1. RGB and Custom Colors (For When Your Designer Gets Specific)
Your designer just sent you a Figma file with exact color codes? No problem. Tailwind lets you use RGB, hex, or any CSS color format directly:
Exact brand orange (rgb(255,107,53))
That specific blue from the mockup (#4A90E2)
HSL blue (hsl(210,100%,50%))
<!-- Using exact RGB values -->
<h1 class="text-[rgb(255,107,53)]">Exact brand orange</h1>
<!-- Using hex codes -->
<p class="text-[#4A90E2]">That specific blue from the mockup</p>
<!-- Using HSL if that's your thing -->
<span class="text-[hsl(210,100%,50%)]">HSL blue</span>
Real talk: I used to waste so much time adding these to my config file. Just throw them in brackets and move on with your life.
2. Text Color Gradients (Make Your Headings Pop)
This one's a crowd-pleaser. Want those Instagram-style gradient texts? Here's the trick:
Sick Gradient Heading
Triple Color Magic
Vertical gradient text
<h1 class="text-5xl font-bold bg-gradient-to-r from-purple-600 to-pink-600 bg-clip-text text-transparent">
Sick Gradient Heading
</h1>
<!-- Three-color gradient -->
<h2 class="text-4xl font-bold bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 bg-clip-text text-transparent">
Triple Color Magic
</h2>
<!-- Vertical gradient -->
<p class="text-2xl bg-gradient-to-b from-green-400 to-blue-600 bg-clip-text text-transparent">
Vertical gradient text
</p>
Pro tip: Always pair this with bold or semi-bold fonts. Thin fonts with gradients look weird.
3. Transitions with Underline AND Color Change
This is probably what you're really here for. Making links look smooth when you hover:
<!-- Simple color transition -->
<a href="#" class="text-blue-600 hover:text-blue-800 transition-colors duration-300">
Smooth color change
</a>
<!-- Color + underline transition together -->
<a href="#" class="text-blue-600 hover:text-purple-600 underline decoration-transparent hover:decoration-current transition-all duration-300">
Color and underline fade in
</a>
<!-- The full package (my go-to) -->
<a href="#" class="text-gray-700 hover:text-indigo-600 no-underline hover:underline underline-offset-4 transition-all duration-200">
Professional link style
</a>
Why this rocks: Your links feel responsive and modern without writing a single line of CSS.
4. Background + Text Color Combos (Stop Guessing)
Here's the thing about text colors—they only look good if the background works with them. Here are combinations I use all the time:
<!-- Light backgrounds -->
<div class="bg-white text-gray-900">Dark text, light bg (classic)</div>
<div class="bg-gray-50 text-gray-800">Slightly softer</div>
<div class="bg-blue-50 text-blue-900">Colored background vibes</div>
<!-- Dark backgrounds -->
<div class="bg-gray-900 text-white">Clean dark mode</div>
<div class="bg-slate-800 text-slate-100">Softer dark mode</div>
<div class="bg-indigo-900 text-indigo-100">Branded dark section</div>
<!-- Colored backgrounds (for CTAs) -->
<button class="bg-blue-600 text-white hover:bg-blue-700">
Primary Button
</button>
<button class="bg-green-500 text-white hover:bg-green-600">
Success Button
</button>
Accessibility check: If you can't easily read it, your users can't either. Use darker shades (700-900) on light backgrounds and lighter shades (50-300) on dark backgrounds.
5. Dark Mode That Doesn't Suck
Building dark mode used to be a nightmare. Now it's literally one extra class:
<!-- Auto-adapts to user's preference -->
<h1 class="text-gray-900 dark:text-gray-100">
Works in both modes
</h1>
<p class="text-gray-600 dark:text-gray-400">
Body text that adapts
</p>
<!-- Links in dark mode -->
<a href="#" class="text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300">
Smart link colors
</a>
<!-- Cards that flip -->
<div class="bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 p-6">
<h3 class="text-xl font-bold">Perfect in both modes</h3>
</div>
Set it up once: Add class="dark" to your html tag based on user preference, and everything just works.
6. Opacity Tricks (Subtle is Underrated)
Instead of memorizing a million different shade numbers, just use opacity:
Less important info
<!-- Disabled state -->
<button class="text-gray-900/40" disabled>
Disabled Button
</button>
<!-- Subtle secondary text -->
<p class="text-black/60">
Less important info
</p>
<!-- Overlay text -->
<div class="relative">
<img src="hero.png" alt="Hero">
<h1 class="absolute text-white/90">
Hero Title
</h1>
</div>
<!-- Hover effects -->
<div class="text-blue-600/70 hover:text-blue-600/100 transition-colors">
Fades in on hover
</div>
Why I love this: You keep your color consistent but change the intensity. Way cleaner than using different shades.
Bonus: Group Hover (Next Level Stuff)
Want child elements to react when you hover over the parent? This is how:
Card Title
Hover anywhere on this card and watch everything change
→ Read more<div class="group cursor-pointer border rounded-lg p-6 hover:border-blue-500 transition-colors">
<h3 class="text-gray-900 group-hover:text-blue-600 transition-colors">
Card Title
</h3>
<p class="text-gray-600 group-hover:text-gray-900 transition-colors">
Hover anywhere on this card and watch everything change
</p>
<span class="text-blue-600/0 group-hover:text-blue-600/100 transition-colors">
→ Read more
</span>
</div>
Quick Reference Cheat Sheet
Here's what I keep on my second monitor:
<!-- Default colors I actually use -->
text-gray-900 /* Main headings */
text-gray-700 /* Body text */
text-gray-500 /* Secondary text */
<!-- Primary colors -->
text-blue-600 /* Links */
text-green-600 /* Success messages */
text-red-600 /* Errors */
text-yellow-600 /* Warnings */
<!-- With hover states -->
text-blue-600 hover:text-blue-800
text-gray-700 hover:text-gray-900
<!-- Opacity variations -->
text-black/90 /* Strong */
text-black/60 /* Medium */
text-black/40 /* Subtle */
Real Talk: Common Mistakes to Avoid
❌ Don't use text-black or text-white directly.
Use text-gray-900 and text-gray-50 instead. They look better and play nicer with other colors.
❌ Stop using transition without specifying what transitions.
Use transition-colors for text color changes specifically. It's faster and smoother.
❌ Your gradients don't need 5 colors.
Two or three max. More than that looks like a rainbow threw up on your site.
❌ Test your colors on different screens.
What looks good on your MacBook might look terrible on a cheap monitor.
Wrapping Up
Tailwind's text color system is honestly one of the best parts of the framework. Once you get the hang of these patterns, you'll be styling text faster than you can say "custom CSS."
Just remember: consistency is key, accessibility matters, and when in doubt, gray-700 on white backgrounds literally never looks bad.
Now go make something cool. And hey, if your text looks good, nobody's gonna care if you used Tailwind or wrote it from scratch. Results are what matter.
Want More Tailwind Components?
Check out our collection of 100+ free Tailwind components including buttons, cards, forms, and more. All copy-paste ready.
Browse All Components