Implementing dark mode with Tailwind and Stimulus
14-Jun-2024 562
Dark mode can be automatic based on system settings or manual based on user action.The preference for dark mode will be based on the prefers-color-scheme: dark media selector and a custom settings in localStorage. If you don’t need a custom switch you could implement this all just with the media selector and Tailwind.The dark theme itself will work based on adding a dark CSS class to the html element. We’ll then configure Tailwind to use this selector to drive the theme change.
Implementing dark mode with Tailwind and Stimulus #ruby #rubydeveloper #rubyonrails #Implementing #Tailwind #Stimulus #stimulus #tailwind https://rubyonrails.ba/link/implementing-dark-mode-with-tailwind-and-stimulus