4 ms·
An observation for people that make websites: if you introduce multiple theme, you are now responsible for ensuring that your content works in all themes. Most
by chrismorgan 5y ago
An observation for people that make websites: if you introduce multiple theme, you are now responsible for ensuring that your content works in all themes. Most of the time things will work tolerably enough (though you may want to tweak things on occasion, e.g. `filter: invert(0.9)` can work on black and white line art), but transparency especially is hazardous.
In this case, this means adding something like the following to glitch.css:
@media (prefers-color-scheme: dark) {
.glitch {
color: white;
}
.glitch:before, .glitch:after {
background: #1c1c1c;
}
/* and, unless you change the SVG one to use clipping or masking instead of a white flood fill, probably easiest to just give it a white background and be done with it: */
[alt="Svg glitch"] {
background: white;
}
}
The code highlighting also needs fixing.
- thrdbndndn 5y ago>An observation for people that make websites: if you introduce multiple theme, you are now responsible for ensuring that your content works in all themes Am I missing something? This very site doesn't seem to offer theme/dark mode on my end.
- chrismorgan 5y agoIt provides one using the media query (prefers-color-scheme: dark). That is, it’s native, up to the browser to decide when to use it.
- krapp 5y ago>Am I missing something? This very site doesn't seem to offer theme/dark mode on my end. Hacker News is always the exception.
- stavros 5y ago> if you introduce multiple theme, you are now responsible for ensuring that your content works in all themes. Sounds like a good way to get people to never introduce multiple themes.
- chrismorgan 5y agoIt’s a very common theme for people to implement something that they personally don’t use, but with problems so that the end result for the people that do want to use it is worse than if they hadn’t done anything. Accessibility is a good example of this, so that, for the web, the ARIA Practices document starts with a big warning, “no ARIA is better than bad ARIA”—because in general if you don’t touch ARIA stuff everything will still be there and usable, but it’s easy to mess everything up if you set things in the wrong way (but you can’t really put guard rails in without crippling the functionality for those cases where it is desired). Dark modes can be added by browser extensions like Dark Reader, and it’s not frightfully uncommon for it to do a better job than the author—on this site, for example, Dark Reader would handle the code highlighting properly, where the author neglected to. (Would it have handled the glitch background thing? I haven’t tried it, but from past experience of how it works I think it would have caught at least the CSS one, but I’m not sure what it would have done with the SVG one at all.)
- stavros 5y agoHmm, I don't see how a bad optional stylesheet is worse than no stylesheet. Sure, the ARIA stuff might be, but those aren't optional. At worst, you can just not use the light stylesheet.
- chrismorgan 5y agoSee the result in this page: dark mode users were presented something broken that completely ruined the main effect of the article, where it wasn’t immediately obvious why it was broken, and which they can’t easily switch away from; whereas if it had done nothing they would have received something admittedly inferior in an important way (light) but functional, by default, and if they use Dark Reader, something superior and functional.
- jakub_g 5y agoPersonally I prefer people to provide dark themes themselves. Dark Reader seemed to be CPU hungry last time I tried, and it would entirely crash some pages even.