Dark mode
AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.
Why it matters
It shows a real, working example of a coding agent handling a full production CSS feature end-to-end, from prompt to commit.
Simon Willison asked Claude Code, an AI programming assistant, to add a dark mode to his blog. It wrote the CSS theme system in one pass, which respects the reader's device setting and includes a footer toggle for auto, light, or dark. Claude Code also built the animated demo image from two screenshots using the ImageMagick graphics tool.
Willison used Claude Code for web to ship dark mode on his blog from a single one-line prompt, with the full diff on GitHub. The result respects user OS preferences via CSS and localStorage, with a manual toggle. AI-generated code duplication was cleaned up afterward with the templating tool Cog, showing where human editing still mattered.
Claude Code generated dark theme CSS using @media (prefers-color-scheme: dark) plus a data-theme="dark" attribute driven by localStorage, with a footer toggle cycling auto/forced-light/forced-dark. Handling both the media query and the explicit toggle caused CSS duplication, which was deduplicated by Cog (github.com/simonw/simonwillisonblog PR #572). The animated GIF was produced via magick with -delay 300, -colors 128, and -layers Optimize.
Read the original
This summary exists to save you time, not to replace the source.
Key terms
Claude Code Simon Willison GitHub Cog ImageMagick localStorage
Was this summary useful?
One click, anonymous. It tells us which summaries to re-run.
Related reading
Code-driven AI illustrations are more useful than images from dedicated image models
Code-driven AI illustrations let designers edit assets directly in code, saving time on iteration and ensuring consistency, which is a game-changer for teams that need rapid, reusable visual content.
A hierarchical note-taking app for building large personal knowledge bases
Trilium lets users build and navigate massive personal knowledge bases without duplicating content, saving time on organization and retrieval.
Desktop apps in Go with native UI or web frontend
Go developers can now ship cross-platform desktop and mobile apps in a single small binary without cgo or heavy runtimes, cutting build complexity and deployment size.
OpenBitFun: an agent workspace with four harness modes and phone remote control
OpenBitFun lets agents run on any machine and be controlled from a phone, eliminating the need to choose between local power and remote access, saving developers time switching contexts.
Intel One Mono: a monospaced font designed with low-vision developers
Developers with low vision or eye fatigue can read code more clearly, reducing errors and improving productivity.