<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Template%3AIf_dark%2Fdoc</id>
	<title>Template:If dark/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://elite.mistflux.co.uk/w/index.php?action=history&amp;feed=atom&amp;title=Template%3AIf_dark%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Template:If_dark/doc&amp;action=history"/>
	<updated>2026-11-01T15:43:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://elite.mistflux.co.uk/w/index.php?title=Template:If_dark/doc&amp;diff=113430&amp;oldid=prev</id>
		<title>Wikipedia&gt;QuickQuokka at 12:03, 16 February 2025</title>
		<link rel="alternate" type="text/html" href="https://elite.mistflux.co.uk/w/index.php?title=Template:If_dark/doc&amp;diff=113430&amp;oldid=prev"/>
		<updated>2025-02-16T12:03:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{Uses TemplateStyles|Template:If dark/styles.css}}&lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;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 [[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 [[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;
&amp;lt;code&amp;gt;{{braces|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;/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 [[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;{{sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Wikipedia templates that change text based on client state]]&lt;br /&gt;
[[Category:If-then-else templates]]&lt;br /&gt;
[[Category:Wikipedia formatting templates ]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wikipedia&gt;QuickQuokka</name></author>
	</entry>
</feed>