5 ms·
You shouldn't be using a checkbox for dark mode (at least not as the main toggle). You should be using the css prefers-color-scheme media query so that you use
by kevincox 5y ago
You shouldn't be using a checkbox for dark mode (at least not as the main toggle). You should be using the css prefers-color-scheme media query so that you use the users default with no required interaction and no bright flash of white.
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pref...
- account42 5y agoToo bad that FF with enhanced tracking protection on reports that the user wants a light color scheme instead of reporting no preference.
- throwoutway 5y agoAgreed, but as a user sometimes I turn it off because an article doesn’t work well with it. So the default should be user’s global preference but I want local control
- account42 5y agoSounds like something that would be better solved by a browser extension than having every website with a dark mode also implement a toggle.
- tomtomtom777 5y agoSo you would like a website to implement a checkbox to toggle dark mode, in case it doesn't implement dark mode correctly? That doesn't make any sense.
- deleted 5y ago[deleted]
- bondant 5y agoI think he would rather have a checkbox to disable dark mode in case a specific website. So he don't have to switch his system-wide preference in order to browse a single badly designed website.
- throwoutway 5y agoExactly
- encryptluks2 5y agoI think the point of checkbox is fine as long as they default to prefers-color-scheme, because there are times when it is nice to be able to switch on a site without having to change your OS color scheme.
- kevincox 5y agoI agree, that is what I meant with the "main" source. It would also be cool if browsers could just add a color-scheme toggle in their UI. That way it can be available for all websites without needing to look around for the in-site toggle. (Firefox has this in the dev tools but that isn't exactly user-friendly).
- Willamin 5y agoI agree that it'd be cool for browsers to add a per-site color-scheme toggle in the UI. While it does lack in many other areas, Safari on MacOS has a wonderful interface for per-site default behavior for: automatically using reader-mode, allowing permissions (microphone, etc), setting page zoom, etc. This would be the perfect place for per-site overrides of the system light/dark mode.
- usrbinbash 5y ago> You should be using the css prefers-color-scheme media query Problem is, this doesn't always work; https://forum.manjaro.org/t/google-chrome-not-in-dark-mode/87259 https://forum.manjaro.org/t/google-chrome-not-in-dark-mode/8... https://forum.manjaro.org/t/why-media-query-always-choosing-light-theme-css-html/77348 https://forum.manjaro.org/t/why-media-query-always-choosing-... Editing config or .desktop files to work around such issues may be an option for experienced user, but even speaking from such a users perspective, I would much prefer a webpage to offer me a simple button or checkbox.
- hobofan 5y agoIf you want to argue with "this doesn't always work", I'd assume that the caniuse statistics[0] are more relevant than an implementation bug that affects less than 1% of browser users. [0]: https://caniuse.com/prefers-color-scheme https://caniuse.com/prefers-color-scheme
- Drew_ 5y agoDid you read these links? The first is a complaint about a browser context menu not the web page and the second is about a GNOME theme which obviously has no affect on CSS in browsers.
- mariusor 5y agoI use both. I have a toggleable button for using the "other" color scheme, but it uses by default the preferred color scheme exposed by the browser.
- dheera 5y agoHTML needs to really catch up already. Who tf uses checkboxes in 2021? Why isn't there an <input type="slide_toggle"> already that uses the native UI? Instead of a shitty div hell to construct a slide toggle, which becomes super laggy if you have to have a scrollable list of 1000 of them.
- recursive 5y agoBut like, it's 2022. Anyway, I've never seen any suggestion that checkboxes are obsolete. They seem easier to use than slide toggles to me. It's easier to tell if they're "on". It's harder for me to remember which direction or color indicates on in a slide. But with a checkbox, it's dead-simple. Simple solution to shitty slide_toggle divs is just use input type=checkbox, since they work perfectly.
- lowercased 5y agoHow about getting tri-state checkboxes?
- withinboredom 5y agoWhat does that even mean? Just use radio buttons and be explicit.
- clairity 5y agocheckboxes do have a third 'indeterminate' state[0], but you can't activate it manually. it's basically 'null' rather than an affirmative 'true'/'false'. [0]: https://developer.mozilla.org/en-US/docs/Web/CSS/:indeterminate https://developer.mozilla.org/en-US/docs/Web/CSS/:indetermin...
- NoSorryCannot 5y agoI won't argue against the value of a native slide toggle, but they have different semantics compared to a checkbox, in my opinion, and you shouldn't use a slide everywhere you had used a checkbox. Slide toggles would be completely bizarre on a survey, for example. "ah yes I'll just turn on 'member of the armed forces'"
- ww520 5y agoI uses a tristate flag: system, light, and dark modes.
- deleted 5y ago[deleted]