←back to thread

451 points todsacerdoti | 1 comments | | HN request time: 0s | 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 #
Sateeshm ◴[] No.45060405[source]
Isn't it just `prefers-color-scheme`
replies(2): >>45060432 #>>45067543 #
1. 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.