Template:Colors/doc: Difference between revisions

From DnD with Extra Tongues
Jump to navigation Jump to search
dnd5efandom>Foxwells
No edit summary
 
m (1 revision imported)
 
(No difference)

Latest revision as of 20:49, 9 June 2019

[[Category:{{#switch: Template | Template = Template | Module = Module | User = User | #default = Page }} documentation]]

Description
Sets background and text colors of a given text. They can be specified by any valid CSS color specification like name, in the format #hhhhhh (RGB hex triplet, where h is 0-f) or simplified #hhh, or hsl(0-360,0-100%,0-100%) / hsla(0-360,0-100%,0-100%,0-1), or rgb(0-255,0-255,0-255) / rgba(0-255,0-255,0-255, 0-1).
Syntax
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: Colors | 0 | 1 }} | : || {{ #if: || Template }} }}:Colors|{{ #ifeq: {{ #sub: Colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | Colors }}]]{{ #if: text color
 | |text color }}{{ #if: background color
 | |background color }}{{ #if: text
 | |text }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }}
Code
<span style="background: {{{2|}}}; color: {{{1|}}};">{{{3|}}}</span>
Standard color names
The HTML 4.01 specification (see web colors on Wikipedia) defines sixteen named colors, as follows:
Color Hexadecimal Color Hexadecimal
black #000000 silver #c0c0c0
gray #808080 white #ffffff
maroon #800000 red #ff0000
purple #800080 fuchsia #ff00ff
green #008000 lime #00ff00
olive #808000 yellow #ffff00
navy #000080 blue #0000ff
teal #008080 aqua #00ffff
Notes
Unless in the case of personal use on a user page, use this template with great caution:
  • a poor contrast may make the text difficult or impossible to read
  • the contrast can be experienced as even poorer in the case of colour blindnes
  • links have a color according to user settings; they become invisible if this color is equal to the background color.
Sample output
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: #ffffff
 | |#ffffff }}{{ #if: #000000
 | |#000000 }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: #aa0000
 | |#aa0000 }}{{ #if: #009999
 | |#009999 }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: white
 | |white }}{{ #if: black
 | |black }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: yellow
 | |yellow }}{{ #if: grey
 | |grey }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: blue
 | |blue }}{{ #if: silver
 | |silver }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: grey
 | |grey }}{{ #if: yellow
 | |yellow }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : || {{ #if: || Template }} }}:colors|{{ #ifeq: {{ #sub: colors | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Colors | colors }}]]{{ #if: black
 | |black }}{{ #if: aqua
 | |aqua }}{{ #if: From [[w:c:templates|Templates Wiki]]
 | |From [[w:c:templates|Templates Wiki]] }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} gives...
From Templates Wiki
See also
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: Fontcolor | 0 | 1 }} | : || {{ #if: || Template }} }}:Fontcolor|{{ #ifeq: {{ #sub: Fontcolor | 0 | 1 }} | : | : }}{{ #ifeq: | Template | Fontcolor | Fontcolor }}]]{{ #if:
 | |{{{2}}} }}{{ #if: 
 | |{{{3}}} }}{{ #if: 
 | |{{{4}}} }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} – change text and background colors like this template
{{ #if: | }}{{{{ #if: | {{{prefix}}}: }}[[{{ #ifeq: {{ #sub: TextColor | 0 | 1 }} | : || {{ #if: || Template }} }}:TextColor|{{ #ifeq: {{ #sub: TextColor | 0 | 1 }} | : | : }}{{ #ifeq: | Template | TextColor | TextColor }}]]{{ #if:
 | |{{{2}}} }}{{ #if: 
 | |{{{3}}} }}{{ #if: 
 | |{{{4}}} }}{{ #if: 
 | |{{{5}}} }}{{ #if: 
 | |{{{6}}} }}{{ #if: 
 | |{{{7}}} }}{{ #if: 
 | |{{{8}}} }}{{ #if: 
 | |{{{9}}} }}{{ #if: 
 | |{{{10}}} }}{{ #if: 
 | |{{{11}}} }}{{ #if: 
 | |{{{12}}} }}{{ #if: 
 | |{{{13}}} }}{{ #if: 
 | |{{{14}}} }}{{ #if: 
 | |{{{15}}} }}{{ #if: 
 | |{{{16}}} }}{{ #if: 
 | |{{{17}}} }}{{ #if: 
 | |{{{18}}} }}{{ #if: 
 | |{{{19}}} }}{{ #if: 
 | |{{{20}}} }}{{ #if: 
 | |{{{21}}} }}}}{{ #if:  |  }} – change text color
Web colors
Non-dithering safe colors