Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

FWIW you can add a light/dark toggle button without any javascript. You only need javascript if you want to persist that preference in localStorage.

Here is an article that was posted to HN which implements the three-state (auto/light/dark) toggle in HTML and CSS only: https://lyra.horse/blog/2025/08/you-dont-need-js/





yo that article is amazing



Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: