<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>暗色模式 on BenzHub</title><link>https://benzhub.github.io/tags/%E6%9A%97%E8%89%B2%E6%A8%A1%E5%BC%8F/</link><description>Recent content in 暗色模式 on BenzHub</description><generator>Hugo</generator><language>zh-TW</language><lastBuildDate>Wed, 26 Aug 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://benzhub.github.io/tags/%E6%9A%97%E8%89%B2%E6%A8%A1%E5%BC%8F/index.xml" rel="self" type="application/rss+xml"/><item><title>TailwindCSS 暗色模式:dark: 變體、v4 切換策略與 FOUC 完整解 | TailwindCSS 完整教學</title><link>https://benzhub.github.io/post/tailwindcss/026-dark-mode/</link><pubDate>Wed, 26 Aug 2026 00:00:00 +0000</pubDate><guid>https://benzhub.github.io/post/tailwindcss/026-dark-mode/</guid><description>&lt;blockquote&gt;
&lt;p&gt;前面幾篇我們把介面練得會隨螢幕伸縮、會回應使用者的每個動作,但畫面始終停在明亮的淺色底上。現代網站幾乎都得提供&lt;strong&gt;暗色模式(Dark Mode)&lt;/strong&gt;,讓使用者在夜間或偏好深色時獲得舒適的閱讀體驗。這一篇 &lt;strong&gt;TailwindCSS&lt;/strong&gt; 的暗色模式,要用 &lt;code&gt;dark:&lt;/code&gt; 變體搭配三種策略(跟隨系統的 &lt;code&gt;media&lt;/code&gt;、手動切換的 &lt;code&gt;class&lt;/code&gt;、屬性驅動的 &lt;code&gt;data-*&lt;/code&gt;),再帶你用 &lt;strong&gt;v4&lt;/strong&gt; 的 &lt;code&gt;@custom-variant&lt;/code&gt; 打造一鍵切換、能記住偏好、又不會閃爍的明暗系統,讓你的介面在白天與黑夜都同樣好看。&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>