Skip to content

[v4] Best method to use CSS variables for multiple themes? #15600

Answered by wongjn
Boston343 asked this question in Help
Discussion options

You must be logged in to vote

Yes, you are missing the inline tag with @theme (#14095):

@import "tailwindcss";

@theme inline {
  --color-primary: var(--primary);
}

@layer base {
  :root {
    --primary: red;
  }

  .blue {
    --primary: blue;
  }
}

Your Play with this change.

Though, your second method would seem like it could work well too.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Boston343
Comment options

@wongjn
Comment options

@Boston343
Comment options

Answer selected by Boston343
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