Replies: 3 comments 1 reply
-
https://cdn.vaadin.com/vaadin-lumo-styles/1.6.0/demo/colors.html#dark-palette might be interesting to look at. |
Beta Was this translation helpful? Give feedback.
-
This would be my preferred method. I provides you with a lot of flexibility. You can detect the user's preference by using a little JavaScript and update the class on the body/html tag accordingly. if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.classList.add('dark');
} You can even respond to change in color scheme preference. |
Beta Was this translation helpful? Give feedback.
-
Since Vaadin was mentioned: An obvious improvement we’d like to do is to make it possible to do this in pure CSS. |
Beta Was this translation helpful? Give feedback.
-
I’ve seen some different approaches, such as https://logaretm.com/blog/2020-02-08-tailwind-dark-mode but lacks the ability to be programmatically changed via a
dark-mode
flag to thebody
element, for example. I’ve also seen https://github.com/danestves/tailwindcss-darkmode/blob/master/index.js which does work withbody.dark-mode
but is a bit more complex.What are you doing to implement dark mode?
Beta Was this translation helpful? Give feedback.
All reactions