What's the easiest way to access colours #1910
-
Within my own JS code is there an interface Tailwind exposes to allow us to access a given colour's, such as I would like to be able to access the tailwind configuration combined with the user configuration within JS is this possible. ? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Following the docs, it would look something like this: https://tailwindcss.com/docs/configuration/#referencing-in-javascript import resolveConfig from 'tailwindcss/resolveConfig'
import tailwindConfig from './tailwind.config.js'
const {theme} = resolveConfig(tailwindConfig)
theme.colors.blue[500] |
Beta Was this translation helpful? Give feedback.
-
I did it very easily by importing import colors from "tailwindcss/colors";
colors.emerald["100"] |
Beta Was this translation helpful? Give feedback.
Following the docs, it would look something like this: https://tailwindcss.com/docs/configuration/#referencing-in-javascript