Remix.run Logo
suprjami 12 hours ago

Gimme a dark/light mode switch. CSS is allowed.

adzm 12 hours ago | parent | next [-]

Use a checkbox, d. Define vars for light mode. Override when checked for dark mode with body:has(#d:checked) and can include the dark mode media query too

zahlman 11 hours ago | parent | prev | next [-]

See https://lyra.horse/blog/2025/08/you-dont-need-js/, via https://news.ycombinator.com/item?id=45056878 (which discussion contains some deeper explanation).

tisc 6 hours ago | parent | prev | next [-]

Why would you build a switch instead of relying on the user’s system settings? The only reason I can imagine is that your dark/light mode is not usable/readable so it forces the user to switch

trnglina 5 hours ago | parent | next [-]

I often use different light/dark settings between apps and my system. Just because I want system UIs to be dark, for example, doesn't mean I want to read long pages of white-on-black prose on your blog.

trinix912 4 hours ago | parent [-]

Seconded. Just because I like to have the browser toolbar dark and GitHub dark doesn't mean I also want to read lengthy articles (LWN) in thin white text on a black background.

yurishimo 4 hours ago | parent | prev | next [-]

Having it default to the users preference is nice, but you should still provide an override. I sometimes use my browser in light mode while my OS is dark mode. Many times, I find the contrast for dark mode websites too low unless I’m in a totally dark room.

wiseowise 2 hours ago | parent | prev [-]

Because I don't want to toggle my whole system theme based on one special website.

johnisgood 12 hours ago | parent | prev | next [-]

Checkbox and :checked are your friends.

10 hours ago | parent | prev [-]
[deleted]