by armchairhacker · 1y ago · 0 comments
> Some people prefer a dark system theme, but light website themes, and vice-versa.
Is this common? Why don't those people configure their browser to use a light theme? Or if they prefer different websites to be different themes, use a browser plugin?
...a more general issue is that every website has to re-implement many things. It's a small issue, but it discourages newcomers, and the redundancy on every website adds up. Ideally, a site should look decent with no CSS, but in order to support legacy sites (a good thing) the default styles are the legacy ones (a bad thing); keeping what even back then would probably be considered "bugs" (except, like how crimes become legal, they managed to become "features" by being discovered too late), such as large images causing horizontal overflow. Honestly, is there a single good reason to make the default font Times New Roman 16px?
Configuring the whole browser to have a light theme is the wrong solution - some websites look better in dark mode and some look better in light mode. Also, the browser setting also affects the UI of the browser itself, not just website contents.
These are of course solvable problems, but the most obvious and trivial way to handle this is just to store an extra flag per-website in the same place as the zoom preference.
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...
Edit: this looks pretty harmless https://github.com/the-code-rider/dark-theme-extension/blob/...
Anyway, a quick readthru of the code of the extension i linked shows it does use content scripts, but also it doesn’t do any network access.
This is particularly important on mobile, as dark is very reflective at day, and light blinds you at night.
img { max-width: 100%; }
(which is one of the things mentioned in that article; it probably would make sense for videos and SVG as well like they mention.) But, if you don't like them, the user should be allowed to customize them. In case this causes problems with web pages that use different styles that interfere with them, then hopefully an attribute could be added to specify that the user's CSS should be used instead of this one (and in some cases the browser might be able to decide this automatically for when the web page does not specify this attribute, e.g. if the styles are only associated with media queries and HTML element names rather than IDs, classes, etc). The user could still override this to disable the web page's CSS entirely if desired, but this would make it possible to specify that the web page's CSS is not needed for styling classes and other more complicated stuff within the specific web page or web app. (If the user does not define their own CSS, then it would use that defined in the web page (or the defaults if there is no CSS in the web page; the defaults probably should be changed to support the light/dark scheme properly for web pages that lack CSS, though), and the hypothetical attribute that I mentioned would be ignored.)