Skip to content

Use CSS variable in custom theme? #2939

Closed Answered by saadeghi
maybebansky asked this question in Q&A
Discussion options

You must be logged in to vote

There are already CSS variables for each color name:
https://daisyui.com/docs/colors/
https://unpkg.com/browse/daisyui@4.9.0/dist/themes.css
And you can use or change these CSS variables on runtime.

It's currently not possible to put the existing CSS variable value in another CSS variable because daisyUI needs to know the value of the color so it can apply the color opacity to them the way Tailwind CSS plugin API needs.
According to the alpha release of Tailwind CSS 4, this limitation will probably be fixed in Tailwind CSS 4 and daisyUI will ve able to allow you put the CSS variable in another CSS variable if you really have to do that.

Let me know if you have any questions

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by saadeghi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants