Closed angelofan closed 1 month ago
Hey man. The idea of this component is to mimic or be aligned with the browser UI. This concerns the language and dark mode. Because user experience start from this custom dialog and continues in browser UI, and it's important to keep it consistend.
OK, thanks for the clarification. This plugin is designed to complement the browser's capabilities, not to extend functionality to project. I understand now.
@angelofan you actually extend your project, but keeping the UX consistent between the app and browser.
My website has a button to manually switch between dark and light mode. The button click event implements the switch by adding or removing the "dark" class to the top level HTML tree.
Why use Dark Mode by adding a "dark" class?
Tailwind CSS recommends doing this. Dark mode in Tailwind CSS:
By referring to Tailwind CSS, we can learn some tips.
For dark mode detection, the package should leave the decision to the developer. Package only detecting the
dark
class of the outer DOM.Packages should not detect
@media (prefers-color-scheme: dark)
. Since it is read-only, projects cannot change the appearance of components by toggling this value.What developers do in their projects
@media (prefers-color-scheme: dark)
and switch thedark
class.Package only do
The package only needs to add the dark mode CSS to the
dark
class, no other behavior is required.More
This issue also resolves #16 .