postImage

Tailwind CSS Colors

blogImage

By Ovuoba Emmanuel

Technical Writer

Tailwind Colors is one of the classes available in Tailwind CSS. Tailwind CSS boasts a lot of default color palettes to choose from for your designs and it also allows one to customize their own colors and use.

Table of Content

  • Introduction
  • Default Tailwind Color Palette
  • Tailwind Background Colors
  • Tailwind Text Color
  • Customizing Colors
  • Extending the Default Color palette
  • Custome Colors
  • Conclusion

Introduction

Tailwind colors allow web designers to create unique and visually appealing web pages. It uses an array of colors to create a consistent, harmonious look and feel across the entire website. It is a great way to create a cohesive design. Tailwind colors also provide a wide variety of colors to choose from, allowing designers to create a unique look.

In this post, you will learn how to use tailwind css colors, to customize the colors and even create your own color palatte.

Default Tailwind Color Palette

Tailwind Colors come with a well made color palette for everyone. Even if you don't know the color to use for your project, you can easily start with the ones provided by Tailwind Color palette.

Gray
colors.coolGray
50
#F9FAFB
100
#F3F4F6
200
#E5E7EB
300
#D1D5DB
400
#9CA3AF
500
#6B7280
600
#4B5563
700
#374151
800
#1F2937
900
#111827
Red
colors.red
50
#FDF2F2
100
#FDE8E8
200
#FBD5D5
300
#F8B4B4
400
#F98080
500
#F05252
600
#E02424
700
#C81E1E
800
#9B1C1C
900
#771D1D
Yellow
colors.amber
50
#FDFDEA
100
#FDF6B2
200
#FCE96A
300
#FACA15
400
#E3A008
500
#C27803
600
#9F580A
700
#8E4B10
800
#723B13
900
#633112
Green
colors.emerald
50
#F3FAF7
100
#DEF7EC
200
#BCF0DA
300
#84E1BC
400
#31C48D
500
#0E9F6E
600
#057A55
700
#046C4E
800
#03543F
900
#014737
Blue
colors.blue
50
#EBF5FF
100
#E1EFFE
200
#C3DDFD
300
#A4CAFE
400
#76A9FA
500
#3F83F8
600
#1C64F2
700
#1A56DB
800
#1E429F
900
#233876
Indigo
colors.indigo
50
#F0F5FF
100
#E5EDFF
200
#CDDBFE
300
#B4C6FC
400
#8DA2FB
500
#6875F5
600
#5850EC
700
#5145CD
800
#42389D
900
#362F78
Purple
colors.violet
50
#F6F5FF
100
#EDEBFE
200
#DCD7FE
300
#CABFFD
400
#AC94FA
500
#9061F9
600
#7E3AF2
700
#6C2BD9
800
#5521B5
900
#4A1D96
Pink
colors.pink
50
#FDF2F8
100
#FCE8F3
200
#FAD1E8
300
#F8B4D9
400
#F17EB8
500
#E74694
600
#D61F69
700
#BF125D
800
#99154B
900
#751A3D

Tailwind Background Colors

We can easily set the Tailwind Background color by using the bg-[color], where the [color] is the name of the color you want applied.

html
<div class="relative rounded-xl overflow-auto p-8">
<div
class="flex flex-col gap-4 font-mono text-white text-sm text-center font-extrabold leading-6 bg-stripes-fuchsia rounded-lg"
>
<button class="bg-green-500 rounded-lg p-3">Green</button>
<button class="bg-purple-500 rounded-lg p-3">Purple</button>
<button class="bg-blue-500 rounded-lg p-3">Blue</button>
<button class="bg-yellow-500 rounded-lg p-3">Yellow</button>
<button class="bg-red-500 rounded-lg p-3">Red</button>
<button class="bg-pink-500 rounded-lg p-3">Pink</button>
</div>
</div>

The Tailwind Background colors are shown below.

Tailwind Text Color

We can easily set the Tailwind colors text by using the text-[name], where the [name] represent the color name.

html
<div class="relative rounded-xl overflow-auto p-8">
<div
class="flex flex-col gap-4 font-mono text-white text-sm text-center font-extrabold leading-6 rounded-lg"
>
<p class="text-green-500 p-3">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
<p class="text-purple-500 rounded-lg p-3">
Odit, corporis. Deserunt expedita numquam aliquid libero ea.
</p>
<p class="text-blue-500 p-3">
Eius sapiente quae adipisci tempora consequatur est dolorum praesentium repellat ipsum?
</p>
<p class="text-yellow-500 rounded-lg p-3">
Odit, corporis. Deserunt expedita numquam aliquid libero ea.
</p>
<p class="text-red-500 p-3">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
<p class="text-pink-500 p-3">Odit, corporis. Deserunt expedita numquam aliquid libero ea.</p>
</div>
</div>

The Tailwind colors text Utilities

Lorem ipsum dolor sit amet consectetur adipisicing elit.

Odit, corporis. Deserunt expedita numquam aliquid libero ea.

Eius sapiente quae adipisci tempora consequatur est dolorum praesentium repellat ipsum?

Odit, corporis. Deserunt expedita numquam aliquid libero ea.

Lorem ipsum dolor sit amet consectetur adipisicing elit.

Odit, corporis. Deserunt expedita numquam aliquid libero ea.

Customizing Colors

By default, Tailwind provides a set of basic colors, but you can add your own custom colors under the colors key in the theme section of your tailwind.config.js file.

Here’s an example of how to add a custom color:

js
// tailwind.config.js
module.exports = {
theme: {
colors: {
// Configure your color palette here
},
},
};

Extending the Default Color palette

If you don't wish to completely override the default colors provided by Tailwind CSS. You can easily extend the color palette in the tailwind.config.js file. You can do this by using the theme.extend.colors section found in the file.

js
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'elegant-green': '#51a868',
},
},
},
};

This generates bg-elegant-green along with the other default tailwind colors palette. As this extension is merged deeply, you can even go ahead to give it a more deeper shade of color.

js
// tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
green: {
250: '#51a868',
},
},
},
},
};

The configuration above adds a class bg-green-250, a shade of green to the already existing ones.

Custome Colors

You can of course, change completely the Tailwind default color palette. You can replace them with your own colors.

js
// tailwind.config.js
module.exports = {
theme: {
colors: {
transparent: 'transparent',
current: 'currentColor',
green: {
light: '#79d191',
DEFAULT: '#299e49',
dark: '#0d6926',
},
yellow: {
light: '#b7c460',
DEFAULT: '#819116',
dark: '#768517',
},
blue: {
dark: '#009eeb',
DEFAULT: '#1fb6ff',
light: '#85d7ff',
},
},
},
};

The code above is an example of replacing tailwind colors palette with your own colors.

Conclusion

Finally, Tailwind Colors empowers designers to unleash their creativity and generate aesthetically pleasing designs without sacrificing usability by enabling color customization and performance optimization.

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner

Related Posts

Comments

...