<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.undertensai.cn/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E6%9D%BF%3AIf_dark%2Fdoc</id>
	<title>模板:If dark/doc - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.undertensai.cn/index.php?action=history&amp;feed=atom&amp;title=%E6%A8%A1%E6%9D%BF%3AIf_dark%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_dark/doc&amp;action=history"/>
	<updated>2026-11-17T03:55:20Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_dark/doc&amp;diff=26915&amp;oldid=prev</id>
		<title>wiki&gt;ExE Boss：​Inline w:Template:Braces</title>
		<link rel="alternate" type="text/html" href="https://wiki.undertensai.cn/index.php?title=%E6%A8%A1%E6%9D%BF:If_dark/doc&amp;diff=26915&amp;oldid=prev"/>
		<updated>2025-11-30T18:38:42Z</updated>

		<summary type="html">&lt;p&gt;Inline &lt;a href=&quot;/index.php?title=W:Template:Braces&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;W:Template:Braces（页面不存在）&quot;&gt;w:Template:Braces&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{Uses TemplateStyles|Template:If dark/styles.css}}&lt;br /&gt;
&lt;br /&gt;
This template detects whether it is being used with dark mode, and displays different content accordingly. This should however NOT be relied upon. For instance: It may not work with the [[:w:Wikipedia:Dark mode (gadget)|dark mode gadget]]. You can use the [https://developer.mozilla.org/en-US/docs/Web/CSS/background-image background-image] property with a URL inside [[:w:Wikipedia:TemplateStyles|TemplateStyles]] with different versions for dark mode and light mode instead.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
Some images and text need to be different depending on the mode selected by the user. This template provides an easy way to do that.&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{&amp;lt;/nowiki&amp;gt;If dark{{!}}&amp;#039;&amp;#039;content for dark mode&amp;#039;&amp;#039;{{!}}&amp;#039;&amp;#039;content for light mode&amp;#039;&amp;#039;&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default, {{tag|span}} tags are used to wrap the specified content. A different tag may be specified using {{para|tag}}&lt;br /&gt;
:E.g. {{para|tag|div}} can be used if the content contains block-level elements.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* This template will only work with Wikipedia&amp;#039;s official dark theme. It will not work with browser extensions such as Dark Reader or [[:w:Wikipedia:Dark mode (gadget)|the dark mode gadget]], due to relying on the &amp;lt;code&amp;gt;&amp;amp;lt;html&amp;amp;gt;&amp;lt;/code&amp;gt; tag having the &amp;lt;code&amp;gt;.skin-theme-clientpref-night&amp;lt;/code&amp;gt; class.&lt;br /&gt;
&lt;br /&gt;
* This template &amp;lt;em&amp;gt;does not&amp;lt;/em&amp;gt; actually switch the content between the light and dark mode; it simply outputs both, and hides the content for the opposite theme using CSS.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
=== Normal usage ===&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{If dark|You are using dark mode!|You are using light mode!}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; yields:&lt;br /&gt;
{{lightdarkcompare|{{If dark|You are using dark mode!|You are using light mode!}}}}&lt;br /&gt;
&lt;br /&gt;
{{Namespace and pagename-detecting templates|state=collapsed}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
[[Category:Formatting templates]]&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>wiki&gt;ExE Boss</name></author>
	</entry>
</feed>