-
Hey guys, quick question is there a way to dynamically change colors on runtime? I would like to be able to call my api get color values and change the colors of daisyui? any help would be appreciated . |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Each color is a CSS variable with HSL values. And you can change the color on runtime by changing the value of CSS variable. |
Beta Was this translation helpful? Give feedback.
-
@saadeghi I see you now use |
Beta Was this translation helpful? Give feedback.
Each color is a CSS variable with HSL values.
You can see the colors of all built-in themes here: https://unpkg.com/browse/daisyui@2.14.3/dist/themes.css
And here you can see the list of all color names and their variable name.
And you can change the color on runtime by changing the value of CSS variable.
If your color has a different format like hex, RGB, etc... you need a JS function (or a node package) to convert the format and extract the HSL values.