Skip to content
Discussion options

You must be logged in to vote

Hey @kpvhn!

To achieve your goal, modify the tailwind.config color specification to utilize relative color syntax. Here's the updated code snippet:

colors: {
  primary: 'rgb(from var(--color-primary) r g b / <alpha-value>)',
}

Check out full example: https://play.tailwindcss.com/juMPtEAft4?file=config

Relative syntax is not universally supported in all modern browsers, but it is available in postcss-preset-env. This allows PostCSS to convert all colors to the compatible variant during the build process.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@amishaaggarwal
Comment options

@kpvhn
Comment options

@amishaaggarwal
Comment options

@slashmili
Comment options

@yamanidev
Comment options

Answer selected by kpvhn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants