←back to thread

451 points todsacerdoti | 3 comments | | HN request time: 0.53s | source
Show context
sbinnee ◴[] No.45060391[source]
I always knew that there should be a way to have a button to change light and dark mode on my website without javascript. But I couldn’t figure it out (pre llm era) and gave up and just used javascript. Now it’s time to make an update on that. This blog motivated me.
replies(3): >>45060405 #>>45060700 #>>45062138 #
1. Sateeshm ◴[] No.45060405[source]
Isn't it just `prefers-color-scheme`
replies(2): >>45060432 #>>45067543 #
2. rebane2001 ◴[] No.45060432[source]
that's the "auto" option, but the comment is taking about adding buttons to switch between the themes too
3. wjrb ◴[] No.45067543[source]
That would be the media query; sort of a long-hand way. I learned about the color function for settings the vars from the article, never saw those in use before.