Simon Willison 12/10/2025

Dark mode

Read Original

The article describes a developer's process of adding a dark mode theme to a website. It explains using CSS custom properties, the `prefers-color-scheme` media query, and a `data-theme` attribute for user control. The implementation includes an auto-detection mode, a manual toggle in the footer, and persistence via localStorage. The author also mentions using Claude Code for the initial implementation and ImageMagick to create a demonstration GIF.

Dark mode

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser