Developing an organized, consistent and beautiful color palette is critical to the design success of a project. Tailwind provides a fantastic color system that makes this very easy to accomplish.

Default color palette

To get you started, we’ve provided a generous palette of great looking colors that are perfect for prototyping, or even as a starting point for your color palette. That said, don’t hesitate to customize them for your project.

Colors - 图1

Colors - 图2

Colors - 图3

Colors - 图4

Colors - 图5

Colors - 图6

Colors - 图7

Colors - 图8

Colors - 图9

Colors - 图10

Customizing

Tailwind makes it a breeze to modify the default color palette for your project. Remember, you own these colors and nothing will break if you change everything about them.

By default Tailwind defines the entire color palette in a colors object at the top of your Tailwind config file. These colors are then assigned to textColors, backgroundColors and borderColors. This approach works well since it provides a consistent naming system across all the utilities. However, you’re welcome to modify them independently of one-another as well.

  1. var colors = {
  2. 'transparent': 'transparent',
  3. 'black': '#222b2f',
  4. 'grey-darkest': '#364349',
  5. 'grey-darker': '#596a73',
  6. 'grey-dark': '#70818a',
  7. 'grey': '#9babb4',
  8. // ...
  9. }
  10. module.exports = {
  11. colors: colors,
  12. textColors: colors,
  13. backgroundColors: colors,
  14. borderColors: Object.assign({ default: colors['grey-light'] }, colors),
  15. // ...
  16. }

You’ll notice above that the color palette is also assigned to the colors key of your Tailwind config. This makes it easy to access them in your custom CSS using the config() function. For example:

  1. .error { color: config('colors.grey-darker') }

Naming

In the default color palette we’ve used literal color names, like red, green and blue. Another common approach to naming colors is choosing functional names based on how the colors are used, such as primary, secondary, and brand.

You can also choose different approaches to how you name your color variants. In the default color palette we’ve again used literal variants, like light, dark, and darker. Another common approach here is to use a numeric scale, like 100, 200 and 300.

You should feel free to choose whatever color naming approach makes the most sense to you.