Tailwind CSS v1.0 is here! Learn more →

Text Color

Utilities for controlling the text color of an element.

Class reference

Class
.text-transparent Aa
.text-black Aa
.text-grey-darkest Aa
.text-grey-darker Aa
.text-grey-dark Aa
.text-grey Aa
.text-grey-light Aa
.text-grey-lighter Aa
.text-grey-lightest Aa
.text-white Aa
.text-red-darkest Aa
.text-red-darker Aa
.text-red-dark Aa
.text-red Aa
.text-red-light Aa
.text-red-lighter Aa
.text-red-lightest Aa
.text-orange-darkest Aa
.text-orange-darker Aa
.text-orange-dark Aa
.text-orange Aa
.text-orange-light Aa
.text-orange-lighter Aa
.text-orange-lightest Aa
.text-yellow-darkest Aa
.text-yellow-darker Aa
.text-yellow-dark Aa
.text-yellow Aa
.text-yellow-light Aa
.text-yellow-lighter Aa
.text-yellow-lightest Aa
.text-green-darkest Aa
.text-green-darker Aa
.text-green-dark Aa
.text-green Aa
.text-green-light Aa
.text-green-lighter Aa
.text-green-lightest Aa
.text-teal-darkest Aa
.text-teal-darker Aa
.text-teal-dark Aa
.text-teal Aa
.text-teal-light Aa
.text-teal-lighter Aa
.text-teal-lightest Aa
.text-blue-darkest Aa
.text-blue-darker Aa
.text-blue-dark Aa
.text-blue Aa
.text-blue-light Aa
.text-blue-lighter Aa
.text-blue-lightest Aa
.text-indigo-darkest Aa
.text-indigo-darker Aa
.text-indigo-dark Aa
.text-indigo Aa
.text-indigo-light Aa
.text-indigo-lighter Aa
.text-indigo-lightest Aa
.text-purple-darkest Aa
.text-purple-darker Aa
.text-purple-dark Aa
.text-purple Aa
.text-purple-light Aa
.text-purple-lighter Aa
.text-purple-lightest Aa
.text-pink-darkest Aa
.text-pink-darker Aa
.text-pink-dark Aa
.text-pink Aa
.text-pink-light Aa
.text-pink-lighter Aa
.text-pink-lightest Aa

Usage

Control the text color of an element using the .text-{color} utilities.

The quick brown fox jumped over the lazy dog.
<input class="text-purple ...">

Responsive

To control the text color of an element at a specific breakpoint, add a {screen}: prefix to any existing text color utility. For example, use md:text-green to apply the text-green utility at only medium screen sizes and above.

For more information about Tailwind's responsive design features, check out the Responsive Design documentation.

The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.

Hover

To control the text color of an element on hover, add the hover: prefix to any existing text color utility. For example, use hover:text-blue to apply the text-blue utility on hover.

<button class="text-blue hover:text-red ...">
  Button
</button>

Hover utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the hover: prefix.

<button class="... md:text-blue md:hover:text-blue-dark ...">Button</button>

Focus

To control the text color of an element on focus, add the focus: prefix to any existing text color utility. For example, use focus:text-blue to apply the text-blue utility on focus.

<input class="text-black focus:text-red ...">

Focus utilities can also be combined with responsive utilities by adding the responsive {screen}: prefix before the focus: prefix.

<input class="... md:text-black md:focus:text-red ...">

Customizing

Text Colors

By default Tailwind makes the entire default color palette available as text colors.

You can customize your color palette by editing the colors variable in your Tailwind config file, or customize just your text colors using the textColors section of your Tailwind config.

{
// ...
textColors: {
-   ...colors,
+   'primary': '#3490dc',
+   'secondary': '#ffed4a',
+   'danger': '#e3342f',
}
}

Responsive and State Variants

By default, only responsive, hover and focus variants are generated for text color utilities.

You can control which variants are generated for the text color utilities by modifying the textColors property in the modules section of your Tailwind config file.

For example, this config will also generate variants:

{
// ...
modules: {
    // ...
-   textColors: ['responsive', 'hover', 'focus'],
+   textColors: ['responsive', 'hover', 'focus', 'active', 'group-hover'],
}
}

Disabling

If you don't plan to use the text color utilities in your project, you can disable them entirely by setting the textColors property to false in the modules section of your config file:

{
// ...
modules: {
    // ...
-   textColors: ['responsive', 'hover', 'focus'],
+   textColors: false,
}
}