Template:If dark
From The Right Wiki
Jump to navigationJump to search
Light modeDark mode
File:Test Template Info-Icon - Version (2).svg Template documentation[view] [edit] [history] [purge]
CSS | This template uses TemplateStyles: |
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 dark mode gadget. You can use the background-image property with a URL inside TemplateStyles with different versions for dark mode and light mode instead.
Rationale
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.
Usage
{{If dark|content for dark mode|content for light mode}}
By default, <span>...</span>
tags are used to wrap the specified content. A different tag may be specified using |tag=
- E.g.
|tag=div
can be used if the content contains block-level elements.
Example
Normal usage
{{If dark|You are using dark mode!|You are using light mode!}}
yields:
Light mode | Dark mode |
---|---|
You are using light mode!You are using dark mode! | You are using light mode!You are using dark mode! |