Please don't force dark mode
iamvishnu.com
iamvishnu.com
From early green or amber text on black mono displays. Grey on black DOS text mode. Light Blue on Dark Blue C-64. Apple 2's grey/white (I don't recall) on black. Even GUI wise, Amiga used a dark-blue background as the default Workbench, with user selectable palettes for everything.
It was Microsoft Windows that changed the paradigm to default to a searing white display with black text in most apps, like Notepad, Word, etc., because "it's more like paper". Sure, paper is white, but it's not glowing white. That transition was painful.
I'm glad to see dark-modes return, I agree there needs to be an option, not just forced dark-mode. Preferably light mode options to use a not-as-bright-as-possible white too.
Lotus 1-2-3 mimicked a spreadsheet and it is not searing white.
Windows adopting the "paper"-white background and whole world drooling over the arrival of Windows 3.1 and 95 is when it became the standard, I think.
Sinclair's ZX Spectrum was black text on white background in 1982.
As for the claim that Macs had no 'mainstream use' for 20 years until the Intel switch... your personal Mac-free life is a sad story, but not remotely universal, and while it's certainly true that Macs always had minority market share, it's insane to suggest they weren't influential.
Before that, people shared information in white paper; and the beginning of the internet brought it back with black text over white background.
Therefore there is no canonical traditional normal, it all depends when one joined.
We haven't yet had a glowing-white paper.
Traditional-normal for computing was a dark background.
There was likely a technological limit in the use of pure white at the start when "emulating" paper. VGA 16-color mode likely meant that the choice was between bright white and medium grey, which was too dark. Configurability has lagged behind though.
The "true black" OLED displays have their part of the display off where there are black pixels, if I am not wrong. So, wouldn't dark mode suit well for those types of displays?
I agree. Most websites with a dark color scheme use a dark grey background and even off-white text.
Paper was, which is black on white.
And you shouldn't have your device or monitor set to glowing white -- turn the brightness down so it's the same as a sheet of paper next to it.
And Windows didn't change the paradigm, the Mac was the first widely available consumer device which did. And its built-in CRT wasn't especially glowing either -- it was less bright than paper in traditional office lighting.
Early computers had "dark" color schemes because the resolution was so low and pixels "bled" brightness, that it was easier to read. As technology improved, that problem thankfully went away, and it's easier on the eyes to read dark text on a light background, regardless of print or screen.
All screens are brighter than white paper under moon light, almost none are brighter than white paper under midday sun.
If you haven't experienced before, I recommend it. It helps you appreciate just how bright direct sunlight is relative to other light sources.
There’s a significant base of users that prefer light mode and dark mode so provide both, it’s generally not difficult to do so.
I disagree that apps should tone down light mode. It’s better that all apps use the same brightness and contrast and then users can adjust their monitor to suit their individual preference.
There’s a significant base of users that hate with a passion all low contrast dark gray on light gray (aka llight mode) or light gray on dark gray (aka dark mode). When has the brain of people promoting this been damaged ?
Paper itself is not that shade.
Arguing that we should use, say, #CCC for white, is like saying that instead of rating things out of a 100, you should rate them out of 70 instead. All you've done is narrow the scale.
For me, the small contrast on pages like HN (in particular with any of the gray text) strains my eyes because it’s more effort for me to see the letters.
But I also read a reasonable amount of PDFs (black on white) which is relatively comfortable on most of my monitors (LCDs with generally low brightness setting to have less light shine into my eyes).
I think what I am saying is, I agree that what is comfortable depends on the user, so websites not moving off the defaults is better, because then users can configure what works for them.
Addendum: The low contrast example on the article is very uncomfortable to read for me.
I'm no paleontologist, but originally humans would use substances like ash and fruit to draw/write on rock/leaves/bark, so white/red/colors on grey/green/brown.
Otherwise I'd use a word like "prehistorical".
check
> Early computers had "dark" color schemes because the resolution was so low and pixels "bled" brightness
this
My early 90s Sun SPARCStation was black on white, right from the boot. The xterm default is black on white too, a default that far predates Windows AFAIK.
I don't really know the full history on all of this, but in my limited knowledge, this seems grossly simplified at best since there seem to have been several popular systems before Windows that used white background colours.
[1]: Video: https://www.youtube.com/watch?v=f72A9AHigeQ
It‘s your fault if you set your display to glowing. My displays, depending on the model, have their brightness setting between zero and thirty.
original was light mode: printer terminals. yes, green-on-black became normal in the mid seventies, and some amber-on-black. but even early lisp machines, the Alto, Smalltalk, W/X/Andrew interfaces, Next, etc - type-on-page, not serial-terminal-ish dark mode.
I was actually alive then, so I can speak to it.
Athena text widgets on X were black on white in the 80's. So was Lisa, Mac, and NeXT, OS/X and SunOS's first GUI. Yes, amber on black was long running, but since you weren't alive then let me tell you something: it sucked. Moving from VT100 (VT104) terminals to actual Sun/Aix machines running X was a HUGE improvement on eye strain.
I was alive for both amber and green screens too.
Please don't suggest people are making things up from times before their birth simply because you have a different view.
> Even GUI wise, Amiga used a dark-blue background as the default Workbench
That's because of cost. It was expected that many people would be viewing Amiga video output on a television via composite output and white-on-blue is something that TVs are good at displaying. The 1080 was like 1/3rd the cost of the A1000 and I'm willing to bet that many, MANY A500s were hooked up to TVs for at least a while after being opened on Christmas.
I used practically every word processor ever made for Amiga. Except for WordPerfect they were all black text-on-white, and WordPerfect you could change that they just kept the default blue and white to match DOS.
It was similar to what the author of the article prefers to dark mode: not-too-bright text on not-too-dark a background.
Don't force having to maintain two modes on websites who don't want to?
> If dark mode is a characteristic of your brand, please ensure you choose a comfortable contrast ratio for the text.
IMHO I usually just flip to the reader mode on my phone browser or desktop browser when I don’t like the theme of a website. This obviously doesn’t work for all websites but it’s a nice work around since most reader modes allow you to adjust coloring yourself.
What are these "dark-mode" (misnomer) sites that don't have a comfortable contrast ratio? I know there are some, but I think they're including a broad swath of primarily light-on-dark sites in this group.
Adjust the brightness on your screen.
X's is pretty good, the background is #000000 and there is some #ffffff content, the text is a bit farther from #ffffff than I'd like but pretty close. https://colorpalettecombos.netlify.app/
> However, light gray text on a dark gray background is easy on my eyes. Here the background is #666 and the text is #E0E0E0 which creates a contrast ratio of 4.34:1.
In my opinion, light mode is better than dark mode in most situations. The only situation dark mode is better than light mode is when you're sitting in a dark room with your screen as your only light source, and most of the time that's not really a healthy situation to be in. Dark mode is a crutch. Turn on a light or go to sleep.
Light mode might be annoying to read in no-light environments, but dark mode is nigh impossible to read in high-light environments. Ever try to read a dark mode UI on your phone on a bright summer's day? Can't read a thing, even with brightness cranked all the way up.
It's always been strange to me how many people without a medical reason for doing so want to sit in dark rooms like cave trolls, but there we are.
At least now operating systems all have switchable modes that get reported to the browser. The browser can/should adapt to whatever setting the OS reports.
But UI design is, with a few islands of rationality in history from people like Paul Fitts, mostly a cascade of poorly applied vibes and fads. First people say that contrast is bad, so then people don't use enough contrast. Then people say that brightness is bad, so people don't use enough brightness. Then people realize why contrast and brightness were important all along and the circle of life continues.
As a millennial, I grew up with rooms being lit by 1-3 relatively dim lampshaded 40-60w incandescent bulbs at night. As a result that’s what feels comfortable and relaxing to me as an adult. Rooms at home being brightly lit at night feels grating and reminiscent of a grocery store or hospital or something.
Look into getting warm white lights. For some reason cool white lights are super common while I do think most people at home would actually prefer warm white.
Things can be bright and cozy.
Why not? Is it not better for lights to be overhead and not directly in your field of view?
Indirect/shaded lamps that diffuse the light over a larger area and reduce its intensity are preferable.
Because screens are not bright enough to use outside or in well-lit environments.
If E-ink or similar technology manages to get a bit better refresh rates, it's going to change building architecture in the entire industrialized world.
An ergonomic screen arrangement, with the display placed such that you're not looking downward at it, should make it basically impossible for an overhead indoor light to interfere with your view.
> If E-ink or similar technology manages to get a bit better refresh rates, it's going to change building architecture in the entire industrialized world.
Fingers crossed. I remember yearning for the breakout of transflective displays that never happened.
The sun is tyrannical where I live, so with current display technology, offices are indeed built somewhat like caves.
Also maybe if you set your screen brightness inappropriately high.
I feel kind of traumatized for years of forced light mode everywhere. It hurts my eyes.
In bright sun when outside, I use light mode. Allmost everywhere else, I won't. So please @everyone thinking like this, don't assume, what is best for me, because your taste is different.
The trick is to set a low brightness, in my case it's a little below what you would call comfortable, but that's because you adapt to it in a sec and will be perceived as good.
If you can't set it too low on the monitor, set brightness to 0 and lower the contrast. If it's still too bright use also brightness/contrast controls in your GPU settings. It is also needed to adjust the settings during the day. But having a more controlled light in your room is a better option.
Once you start getting comments from others that they can't see shit on your screen then you've set the correct level :)
Another very often forgotten thing is to set up correct gamma correction! Yes that thing from CRTs is often needed on LCDs too! LCDs can produce quite big contrast which is unpleasant, for example I set mine to 1.3, fixed it nicely for me.
One approach to find a good value is to have antialiased text both in white-on-black and black-on-white and switching between these. Once the apparent thickness is the same then you've got the right value. Beware of ClearType settings though, you may need to do the test with a classic antialiasing instead.
The result is that you can comfortably use light mode in total dark room without any issues.
Search for utilities that can set the monitor using DDC (Display Data Channel).
I have written another post about how to set the monitor: https://news.ycombinator.com/item?id=42762770
I always hated it on CRTs where photographs were too dark, had to use a really big gamma correction on them (2.5), I guess I've got used to it from these times because it was a necessity to be compatible with LCDs.
The photos and videos are more dull when compared to a reality, but consistent with other stuff on the screen. I have no problem doing color stuff for things like textures, website design etc. The relative comparison to other material is enough for me. I've been working with graphics designers with calibrated monitors and didn't get any complaints.
But I don't do anything that requires working with calibrated monitors, like printing. Though it's hard to tell if it would be an issue. You need to do test prints anyway. You have to use specific named colors (Pantone). Based on that you can just imagine how it would look, no need to have it precisely shown all the time.
Actually, the browser has the ability to set a default background and foreground anyway, so this extension would be unnecessary if websites would behave properly and respect these defaults unless they really need to. We live in an unfortunate world where a “actually respect my preferences” extension is necessary, but since it is necessary, it should be noted that it covers both options. Overall the situation is pretty stupid but hey at least we’ve got workarounds, right?
I think the prefers-color-scheme media query would be respected on more sites if by default it had the value "unset" or something, instead of defaulting to "light" or "dark".
I personally don't respect it on my sites for this reason. 99% of people visiting my sites won't actually have set this value themselves.
I mean, they really don't (the defaults are exactly what they have been since Mosaic left the scene). Unless the user tells them to do something else.
And at that point, it's my computer, and I told it to do something, why shouldn't it do that?
It's inherited from their operating system settings. Dark theme is typically opt-in.
For me, I have trouble focusing when reading light mode content, but dark mode is perfectly fine (light backgrounds seem not still, as if there is movement, and this effect lessens the darker the background is.
Backlit screens are difficult to read in high-light environments regardless of whether you're reading black text on white or white text on black. I use white-on-black ("dark mode") on my e-ink Kindle to read outside all the time. And the same is true on our Daylight computer. White-on-black remains my preference in high-light environments.
As a software developer, who codes about 15 hours a day (day job and personal projects), I ditched "light mode" many years ago as it's too harsh on my eyes to be staring at a bright white screen that many hours a day. Dark mode is far easier to look at for long periods of time.
I have no trouble reading code in dark mode in a well lit room. If it were difficult to read, it wouldn't last 15 minutes for my needs. I don't code in "D4rK M0D3" in the dark, I'm not a l337 H4CK3r.
>Ever try to read a dark mode UI on your phone on a bright summer's day?
Phone in direct sunlight is one thing. That isn't the way most people use devices, that's a more rare use case than sitting at a desk 8 hours a day staring at a bright screen. There are also high-contrast modes for eyesight challenged people, which can be used effectively in bright sunlight too, but I'm not going to code that way for hours a day if I don't really need to. Phones and other devices also have adaptive brightness, so if you are in a dark room the phone's display brightness is going to be dimmer automatically, and I'm not really sure you know the difference between "dark mode" and "brightness turned down". So using a phone screen and high contrast required for using screens in direct bright sunlight is a poor example to support your argument. Maybe you also need to qualify all of your arguments with "on a mobile device in bright sunlight", because that isn't the main use case for "dark mode".
If your screen at the brightest setting hurts your eyes, why would you use it like that?
Please explain.
> sitting in a dark room with your screen as your only light source
is also really not great for your eyes, in the same way that having a bright light source in your field of vision (e.g. a window without blackout shades directly behind your monitor) isn't either.
I'm using computers/TV/Phones in dark room, on an average 12h+ a day, for ~20 years. My eyes are just fine. Last time (and only time) I went to an eye doctor two years ago because people like you keep saying my eyes are damaged, the doctor asked me why am I wasting my money going to eye doctor.
Also, I don't drink coffee (less than 5 times a year). There are plenty of people who sleep at proper time and still drink a lot of coffee all day.
Beyond that, I have no preferences between light and dark modes on laptop screens and smaller. But I prefer having at least some dark elements visible on large screens, because floaters can be distracting against large bright surfaces. Usually it's a terminal window with the traditional light gray on black color scheme, but I tend to use dark mode in IDEs and other full-screen apps.
When screen is too dark (sunlight, etc), I make it brighter. Requires >=400 nit or whatever that unit is for an average day.
It's really not that extreme. Dark mode is more comfortable as soon as it's dark outside (this time of year that starts between 3 and 4 pm) unless I'm flooding my entire room with enough light to replace the sunlight. I still have the lights on, but none of that light is as bright/white as an average white webpage. Even with screen brightness turned down and a blue light filter, an all-white webpage is usually just too much white.
> Light mode might be annoying to read in no-light environments, but dark mode is nigh impossible to read in high-light environments.
This is just completely opposite for me. Reading in dark mode is only uncomfortable if there's sunlight basically directly behind the screen, while light mode is only really comfortable in high-light environments.
This. once stuck outside with limited battery and tried switching to light mode. could instantly reduce brightness and still see everything.
the nature of lcd display makes it hard to display contrast without backlighting. but the early ones could be effective by showing dark details on a blank slate. this situation brought back my appreciation for having this mode.
The author also changes their mind halfway through and decides the problem is actually color contrast, not dark mode.
Ironically they end by saying they'll use an invert filter as a workaround, while for those who prefer dark mode if doing the same on the author's own stark white bg/black text site (such as Vivaldi's 'Invert Mode') will produce the very contrast ratio in dark they're complaining about :p
If you wanna argue that we shouldn't force dark mode, maybe don't go around forcing light mode. My eyes hurt.
html {
filter: invert(1);
}
img {
filter: invert(1);
}
Bookmarklet edition: javascript:(function(){var s=document.createElement("style");s.innerText="html{filter: invert(1);}img{filter: invert(1);}";document.head.append(s)})()
(doesn't and can't fix CSS "background-image" but you'll live) color: #111;
background-color: #fdfdfd;
which is a contrast ratio of 18:56:1.The recommended grey-on-grey may be unreadably low in contrast when viewed on, for example, 0 brightness in a pitch black room, or in direct sunlight
The full SDR colour range is there to be used, this isn't HDR where you need to limit things to not blind your users
Browsers have handed over way too much control to developers to ignore what the user wants. So much for being a "user agent." Browsers are more like the developer's agent.
The developer needs to do additional work to un-standardize their application.
This is what I do and it makes browsing the web so much better.
For developers, the `color-scheme` CSS property allows an element to indicate which color schemes it can comfortably be rendered in.[1]
:root {
color-scheme: light dark;
}
element { light-dark(light-color-code, dark-color-code);
For users on macOS, I like dark mode in some cases, such as the Menubar and the IDE, but light for other activities, such as reading, writing, and browsing. Hence, it is a mixed preference;System Preferences, then set the theme to LIGHT, then run
defaults write -g NSRequiresAquaSystemAppearance -bool Yes
Logout, then System Preferences, then set the theme to DARK.Reset back to the default theme.
defaults write -g NSRequiresAquaSystemAppearance -bool No
1. https://developer.mozilla.org/en-US/docs/Web/CSS/color-schem...What kind of eye condition or monitor does he have?
@media (prefers-color-scheme: dark) {
CSS Rules here...
}I think the ideal thing to do would be to move back to greys as the base color for computer interfaces, like we had when bright CRTs were the norm. This has the added advantage of allowing depth affordances in UI elements, which we should also bring back.
OS9:
https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2F...
Windows NT:
https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2F...
BEOS:
(I'm taking no offence, but it may be important to point out what's what, now that image references are becoming as inevitably as increasingly unreliable, as for "AI".)
Personally I am blinded by light mode and it hurts and strains my eyes, everyone is different.
Yeah, but it uses too many resources on my 4.4GHz Ryzen with 32GB of RAM. I wonder how Apollo was able to do this on a 20 MHz 68020 with 4MB of RAM while running a network distributed multiuser, multitasking OS. /s
You can control the contrast ratio on dark mode websites with the "brightness" control on your monitor. It changes the emissivity of the pixels. Turning it down keeps black the same color and makes whites blacker. Monitors typically ship with the white level way too high for any real work (it looks good in the computer store though), and so you should probably always be turning this down.
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
But the difference this time is that because the dark mode people are wrong, and always have been, and always will be, when the pendulum swings back, it will swing hard, for it will swing with the momentum of righteousness and truth, and the repercussions will ring through history.
Ask yourself: where will you be standing, when this happens?
What is that supposed to mean? Some people find it more pleasant to read on a dark background (e.g. because of photophobia), some prefer it for aesthetic reasons (e.g. for a site about space exploration), how is that ‘wrong’?
PS: unless you are adhering to a system default, you better include options for everyone, not just one demographic. For example after recent redesign ArsTechnica has created a selection of different modes. And while some people like darker mode, I'm happily using "hyperlight" because it is easier to read for me.
Phoning home is more important than the eyes of a user. And the new UXs cannot draw shadows, only surfaces.
Also from an article in Nature. “Impact of text contrast polarity on the retinal activity in myopes and emmetropes using modified pattern ERG” 09 July 2023.
“Recently, reading standard black-on-white text was found to activate the retinal OFF pathway and induce choroidal thinning, which is associated with myopia onset. Contrarily, reading white-on-black text led to thicker choroids, being protective against myopia. Respective effects on retinal processing are yet unknown.”
This whole "dark mode" thing only happened because Apple removed all color and affordances from their interface in iOS 7, and then Mac OS later. They set computer interface design back decades with that decision.
For people complaining about "light mode", please just turn down your brightness. Your screen does not need to be at 10,000 nits when you are anywhere but in direct sunlight.
[1]: https://anthonyhobday.com/sideprojects/containercolours/
OP could just use that if they want to get rid of styling and get a consistent look.
Curious then what is the real driver of these issues? If accessibility teaches us anything, it’s that there’s certainly no one size fits all. But it’s gonna be hard to update the standards or make plugins/tweaks successfully unless we get at the root of it.
WCAG is known to be inaccurate for dark mode because contrast ratios do change when you switch the color order. See this improved way to measure contrast that takes this into account:
https://git.apcacontrast.com/documentation/APCAeasyIntro.htm...
Please don't force light mode. Light mode is only reasonable on E-Ink displays, where white is only reflective and does not emit light.
>Every time I finish a long article, I end up seeing horizontal stripes everywhere I look, like my eyes just won’t let it go.
I would seriously consider talking to your doctor about this. This seems abnormal.
> Please don't force light mode
Dear UX, UI designers, please don't force any mode. Let the user choose colors like it was normal since some time ago.
> I would seriously consider talking to your doctor about this. This seems abnormal.
The doctor does not come with those ideas, unfortunately. /s
I'd suggest browsers come out of the box with a decent contrast range that they will use to display text, but users should be able to modify those settings. In general, browsers should be a lot more willing to override bad webdesign ideas. They already block popups and blink tags; there's plenty of other behaviour they simply shouldn't tolerate from websites.
I can't say that I share his opinion. I find dark-mode preferable under pretty much all circumstances, and often find myself flinching when switching to a site with a fully white background.I also find it easier to read ebooks in dark mode when in full sunlight when reading on my tablet -- also the opposite of his preference. And I'm wondering whether perhaps he needs to turn down the brightness on his monitor.
I prefer black on white (and dream of a eInk-only laptop and a perfectly lo-fi UI with no unnecessary elements/decorations/effects) because that feels more ADHD-friendly to me. Dark modes look cool and make sense when you work in the dark, as long as you set the text font color to grey rather than bright white/green/whatever. The user should choose, using a single system-wide switch.
IMO every website should have a native dark & light mode theme. There is a browser extension, Dark Reader, which changes the CSS to force dark (or light) mode but it can be really hit or miss depending on how the site was coded.
For me it’s the opposite, I need maximum contrast. It’s a pity we can’t just have default text color on default background color, and everyone can adjust their browser to their preferred colors. While there is reader mode and plugins that try their best, they don’t work consistently, because HTML and CSS is such a mess.
I don't really care what other people prefer, software manufacturers with any more than a few users need to test all permutations. This is a minor annoyance but gives a clear indication that there isn't good testing even with one of the most used apps with a huge user base.
I'm sure there are filters to do that on both desktop and mobile.
I’m dating myself, but this was all so easy with CRT monitors, which had a simple analog contrast dial, and everyone just set it to their preferred level.
I suspect that the next thing will be HaloLite 2.0, where a ring of light appears around the screen.[1] There are TV backlights.[2] Backlights that follow the screen color.[3] There is at least one phone with backlights.[4]
Does anybody like that stuff?
[1] https://movingimage.org/collection/artifact-halolighttv/
[2] https://www.inspiredled.com/product/universal-backlight-kits...
[3] https://www.theverge.com/22566408/govee-immersion-ambilight-...
[4] https://www.phonearena.com/news/Nothing-Phone-1-What-do-the-...
It also depends a bit on how long ago I had my prescription changed and how much I was able to convince the doctor to do a good job.
Too many leave theirs at eye-searingly bright and then complain.
APCA is a proposed replacement contrast calculation that was in discussions for WCAG 3 that mentions a maximum contrast value to avoid eye strain like this (https://www.myndex.com/APCA/, I'm getting SSL errors right now though).
I wrote an accessible palette creator tool where you can switch between WCAG 2 and APCA contrast checking to see how they compare (go to "... > Flip to dark/light palette" to explore a dark mode palette):
https://www.inclusivecolors.com/
Along with not having a maximum recommended contrast, WCAG 2 is also meant to be really inaccurate at measuring dark mode contrast, where it'll say colors contrast well when they don't. APCA is meant to fix both these problems.
I am free to ignore these websites if I don't find them easy to read, I can use reader mode, modify their css or disable css altogether if I am not happy, as everyone else.
But the linked article opens fine in reader view for me. You can also force reader view for any site in desktop Safari with CMD+Shift+R
No, there's not “a few exceptions”. It's really rather common for aites not to display in Reader Mode at all; far too common to be called “exceptions”, and nowhere near “a few”.
Where it reliably doesn't work is web application type sites, which is a given.
So reader view solves the problem in most of the cases, and in the cases where it doesn't solve the problem it doesn't make anything worse either.
What's "forced reader view"? If I could force it (and get a readable result every time), there'd be no reason to be even a little angry.
I feel the opposite, this actually seems quite rare.
Almost any blog should work fine in reader mode as well.
Yes, it is a disease. /s
/* Dark mode */ @media (prefers-color-scheme: dark) { ... }
The issue with both dark and light modes is so many designers seem to have jumped onto the idea that colour schemes have to be either bright white or darkest black.
I'd much rather see colours that are 'slightly darker' at night and 'slightly lighter' in the daytime. For one thing there are still so many websites with no colour schemes setup at all so if you avoid going to extremes it minimises the contrast difference.
The optimal approach is applying the appropriate `prefers-color-scheme` using CSS alone, while additionally allowing a theme override using JS/storage. Fewer do this though, even though it wouldn't require any cookies and thus no consent dialog.
The worst are sites that only have theme switching gated behind registration.
On page load you get your javascript to check the mode and check the override to add a class to the whole page. It is this class that implements the desired light or dark theme.
Fighting against you is what the browser is doing. You can put a meta tag in to force it to respect one theme or the other so it does not go freestyling.
People that have a page permanently set to light mode (or dark mode) have put in the meta tag but they haven't done the extra work to implement some meaningful choice.
In summary, there is auto, where the browser does its best, one mode enforced with a meta tag, then a full solution where there is a pretty button on the page and some javascript to honour the preference, keeping the preference in local storage.
Bonus points for adding an event observer to detect the change in preferences from outside the browser or in dev tools.
More bonus points for having no FOUC.
Extra, extra bonus points, is to implement not just a 'dark mode', but a DARK mode. In light mode everything is kittens and rainbows, whereas in dark mode the content is kind of gruesome and 'dark'. Any subject can be treated this way, a page on say, watermelons could be full of tasty recipe ideas in light mode, but, in dark mode, it could be about dropping them off tall buildings with busy streets below...
pls at least provide a switch...
I don't want the primary background color of my computer to be dark as I'm browsing the web but I want only the periphery control items like the browser address bar, etc. to be dark.
I have the Dark Reader extension to dim white backgrounds only at night.
(In which case, please also stop all ads)
Neither dark mode nor light mode is the one true “main” option. We had dark mode for a long time with terminals. Then light mode a long time with word processors and the web and OSes. And now we kinda have both.
A little bummed seeing how hostile most of the comments here are but I guess it's to be expected if most commenters are seeing very differently than how I and the author are.