Trying out a Two-state Dark Mode Toggle

Zach Leatherman · 2026年9月11日

AI 摘要 AI 生成,可能有误

文章讨论了 Lea Verou 的提议:深色/浅色模式切换只需向用户提供两个选项,而不是三个(系统、浅色、深色),因为“系统”选项最终总会解析为深色或浅色。受此启发,作者在自己的网站上实现了一个双态切换开关:它会显示当前主题,点击可切换到与系统偏好相反的主题,并在恢复自动模式时清除任何已保存的覆盖设置。虽然 Bramus 批评了这种做法,认为它对系统偏好会自动切换的用户不友好,但作者认为这种更简单、视觉上能即时响应的控件值得做出这一取舍。

Update

I made some updates and released it as a web component: details in Solar Eclipse Toggle, a Dark/Light mode Toggle Web Component.

Lea Verou sparked some lovely discussions about dark/light mode toggles by asking a simple question: do these form controls need three options for two user-facing states?

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Zach Leatherman

Your Tools are Hiding npm Audits from You

AI 摘要This article argues that npm audit results can be misleading because tools like Next.js bundle 139 of their own dependencies outside of standard auditing mechanisms, hiding 3 critical vulnerabilities—more hidden critical vulnerabilities than visible ones in the no-longer-maintained Gatsby. Similar practices of bundling dependencies or suppressing audit output exist in Vite, various create- CLI tools, and package managers like pnpm and yarn, undermining transparency in security auditing. The author built the Prototype Pollution Report, a daily-updating comparison of vulnerability counts across framework ecosystems, to normalize these discrepancies and provide clearer security insight.

All of my 300+ browser tabs are beautiful

AI 摘要The article introduces a Firefox addon the author built to manage their habit of hoarding 300+ browser tabs. The addon provides features such as sorting tabs by recency, detecting duplicates, searching/filtering by title or URL, full undo/redo support, and a 'Saved' section for storing tabs to restore later. It also supports multi-account containers, identifies tabs playing audio, shows stale tabs, offers light and dark modes, and can merge all tabs into a single window.

“AI, make the website good”

AI 摘要The author reflects skeptically on the current AI-driven wave of development tooling—agents that plan, write, review, and orchestrate code—questioning whether these developer-experience improvements actually translate into better software for real users, just as similar promises around client-side rendering and the single-page-application era failed to do. Citing anecdotal declines in software reliability and poor performance/accessibility scores among AI-related sites, the author suspects this cycle repeats the old playbook at an accelerated pace. They conclude that craft, defined as caring about the quality of output regardless of the tools used to produce it, is more important than ever.

Icon Fall Web Component

AI 摘要The author introduces , a web component that makes icons (including emoji) fall across a website, created as a follow-up to . Originally built as an easter egg for Blog Awesome, it is now publicly available on GitHub and installable via npm. It offers configuration options for the icon count and a customizable, comma-separated list of colors.

Table of Contents Web Component

AI 摘要The article introduces a zero-CSS table of contents web component that can either progressively enhance server-rendered or hierarchies or client-render them, highlighting which headings are currently visible in the viewport. Extracted from the WebC Tugboat starter project for standalone use, it is available on npm as @zachleat/table-of-contents, with demos shown on the author's blog and Blog Awesome. Developers can configure a selector attribute to control the heading search scope, defaulting to main :is(h2, h3, h4, h5, h6).