My avatar

flewkey

Level 10 Computer Mage

Respect my damn color scheme preference

Published on 2021-11-08 by flewkey

I recently switched from light themes to dark themes. Dark themes seem to be supported enough that most applications seem to work with them. Many websites don’t, but it’s not the end of the world. Theming is hard and I do not expect developers to support it.

However, I find it inexcusable and frustrating when a website already has a dark theme, but ignores the user’s preferences. Especially if they have a stupid little theme selector that writes to a value in localStorage or something.

That’s not how you do that!

If you must use JavaScript to set your themes, consider taking your user’s color scheme preference into consideration when choosing which theme to default to. We will be grateful.

if (window.matchMedia("(prefers-color-scheme: dark)").matches)
	/* Set theme */

Even better, you can just use a media query like a normal person. If you need to override it with JavaScript later, you can do that.


Articles from blogs that I like

Alpine Linux does not make the news

My Linux distribution of choice for several years has been Alpine Linux. It’s a small, efficient distribution which ships a number of tools I appreciate for their simplicity, such as musl libc. It has a very nice package manager, apk, which is fast and maint…

From Drew DeVault's blog
Published on July 25, 2023

On Furries and the Media

Recently, there has been a lot of misinformation and propaganda flying around the American news media about the furry fandom. Unfortunately, this seems to be increasing with time. Consequently, there are a lot of blanket statements and hot takes floating …

From Dhole Moments
Published on June 6, 2023

Question #30: What is the F*cking “Colour” of Light?

Hello. I just wanted to let you know that the dimwitted author set their password to “password”. This left a glaring security hole in their website. I’ve just read over all of this nonsense, and I’d like to tell you all that you’ve wasted your time. The a…

From The Hitchhiker's Guide to Digital Colour
Published on March 18, 2023

Generated with the spectacular power of openring