Template:Dark mode switch/doc
| This is a documentation subpage for Template:Dark mode switch. It may contain usage information, categories and other content that is not part of the original template page. |
Lua error in Module:TNT at line 159: Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:I18n/Uses TemplateStyles.tab. This template detects whether it is being used with dark mode, and displays different content accordingly. This is useful when using logos, and the user may want both versions of the logo in dark mode.
Usage
[edit source]{{Dark mode switch|dark mode wikitext|light mode wikitext|suffix for captions}}
Example
[edit source]Normal usage
[edit source]{{Dark mode switch|[[File:Light logo of YouTube (2015-2017).svg|100px]]|[[File:Dark logo of YouTube (2015-2017).svg|100px]]|logo}}
Note the light-coloured logo is used in dark mode, and vice versa.
When to use this template
[edit source]When dealing with simple images consisting of a single color on a transparent background where only the invert feature is required, using the skin-invert (or skin-invert-image) class is probably enough. As an example,
[[File:Dark logo of YouTube (2015-2017).svg|100px|logo|class=skin-invert]]
renders
without the added burden of a specific template. See this topic on mediawiki.org for more info.