palette

[CSS] Switching theme in Tailwind

Basic Knowledge: CSS, HTML, JS, React Preface Tailwind provide dark mode to set dark theme style individually by adding keyword dark: in front of any CSS class: <div class="text-black dark:text-white"> <!-- ... --> </div> If we want to make a theme switcher, it seems feasible by using dark:. But it will be restricted to only TWO themes. Another disadvantage is, since we use dark: syntax in CSS class on HTML...

Oct 14, 2022 Published · Oct 3, 2024 Updated · 2 min · Inori Inuyama