My avatar


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

Breaking down Apollo Federation's anti-FOSS corporate gaslighting

Gather around, my friends, for there is another company which thinks we are stupid and we enjoy having our faces spat in. Apollo Federation1 has announced that they will switch to a non-free license. Let’s find out just how much the Elastic license really is…

From Drew DeVault's blog
Published on November 5, 2021

Computer Science Basics: Types (in dart)

Inside of the dart language most types come from from the parent type Object which could be called the root type in this case. From the root type in the case of dart you can end up with a type tree a little like this for the basic types. With this tree her…

From Technically Alex's blog
Published on May 11, 2021

I just learned something about batch files, and it shocked me.

It turns out the move command in batch always overwrites the destination by default, how fuck have I been using windows for 20 years without ever discovering this? I have written so many batch files over the years, how could … Continue reading →

From DeadFish Shitware
Published on January 29, 2021

Generated with the spectacular power of openring