How to add multiple themes? #1124
Replies: 3 comments
-
did u find the answer ? |
Beta Was this translation helpful? Give feedback.
-
@SikandarJODD A nice person on their discord server did present a solution although I haven't tried it yet as our plans for the theme changed. Pasting it here for reference: My question: Hi, how do I dynamically change the theme, like on here: https://www.shadcn-svelte.com/themes? Answer: "In order to update the theme, you need to update the variables as defined inside of your So I'm guessing you can have a theme store, and then based on that store, change the Let me know if it works for you and I can mark this as the answer. |
Beta Was this translation helpful? Give feedback.
-
Use mode-watcher. It will applies 'theme' to the element via the data-theme attribute. And in your tailwind html[data-theme='orange'] {
--primary: oklch(0.8 0.18 50);
--primary-foreground: oklch(0.1 0.05 50);
--sidebar: oklch(0.98 0.02 74);
--sidebar-accent: oklch(0.95 0.04 75);
--toggle-text: oklch(0.8 0.18 50);
--toggle-hover: oklch(0.95 0.04 75);
--toggle: oklch(0.98 0.02 74);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How do I add multiple themes like here: https://www.shadcn-svelte.com/themes, allowing the user to switch between them?
Beta Was this translation helpful? Give feedback.
All reactions