Onkar Kole
Onkar Kole

Reputation: 1347

How to add RGB color code in Tailwind Css?

I want to replace the default color palette with my own custom colors, add RGB color codes directly under the theme.colors section in configuration file.

Upvotes: 3

Views: 12750

Answers (2)

erff-on
erff-on

Reputation: 398

you can easily use it like bellow :

    /** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    "./app/**/*.{js,ts,jsx,tsx}",
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    container: {
      center: true,
      padding: "10rem",
    },
    extend: {},
    colors:{
      primary : {
        light:'#00976A',
        dark:'#4EBE86',
      },
      border :'rgb (161,161,161,50%)'
    }
  },
  plugins: [],
};

Upvotes: 0

Dhaifallah
Dhaifallah

Reputation: 1825

You could add them as you mentioned in tailwind.config.js like this:

module.exports = {
  theme: {
    extend: {
      // ...
    },
    colors:{
      green:'rgb(12,159,100)'
    }
  },
  plugins: [],
}

Upvotes: 2

Related Questions