Skip to content

Migration to v4 css based config #13813

Closed Answered by wongjn
merzainc asked this question in Help
Discussion options

You must be logged in to vote

I could specify colors as backgroundColors, borderColors, and stroke separately. What's the equivalent of this in v4? Could you provide an example?

The equivalents are:

v3 v4
backgroundColor.key --background-color-<key>: <value>
borderColor.key --border-color-<key>: <value>

See this Tailwind Play


Also, how can I define my colors for both dark and light modes in the same config file using CSS variables?

You could consider using the light-dark() function like:

@import "tailwindcss";

@theme {
  --color-foo: light-dark(white, black);
}

Or you could use the prefers-color-scheme media query like:

@import "tailwindcss";

@theme {
  --color-foo: white;
}

@media (prefers-color-s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@merzainc
Comment options

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