Jump to content

Template:Color/doc: Difference between revisions

Dat Hack3r (talk | contribs)
Added {{High priority}} because this template is original to this Wiki (i.e., it was not pulled from Wikipedia).
Dat Hack3r (talk | contribs)
m Better wording
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{High priority}}
{{High priority}}
{{tlx|Color}} generates a stylized color box that displays a color name or value in that color alongside a matching swatch. The color can be specified as either a CSS color name (e.g., <code>royalblue</code>) or a hex triplet with the <code>#</code> prefix (e.g., <code>#4169e1</code>). The color value can be passed either as the first positional parameter or via {{para|color}}. The color box automatically chooses either a light or dark background to maximize contrast, ensuring a contrast ratio greater than 4.58 and exceeding the [https://www.w3.org/TR/WCAG22/#contrast-minimum WCAG 2.2 AA minimum] of at least 4.5 for normal-sized text.
* {{tlx|color|royalblue}} →
*: {{color|royalblue}}
* {{tlx|color|#4169e1}} →
*: {{color|#4169e1}}
* {{tlx|color|khaki}} →
*: {{color|khaki}}
* {{tlx|color|#f0e68c}} →
*: {{color|#f0e68c}}
* {{tlx|color|<nowiki>color=royalblue</nowiki>}} →
*: {{color|color=royalblue}}
* {{tlx|color|<nowiki>color=#4169e1</nowiki>}} →
*: {{color|color=#4169e1}}
* {{tlx|color|<nowiki>color=khaki</nowiki>}} →
*: {{color|color=khaki}}
* {{tlx|color|<nowiki>color=#f0e68c</nowiki>}} →
*: {{color|color=#f0e68c}}
== TemplateData ==
<templatedata>
<templatedata>
{
{
"params": {
"params": {
"color": {
"1": {
"description": "CSS name of color or hex code of color, e.g. 'red' or '#00F000'.",
"label": "Color",
"autovalue": "000000",
"description": "CSS name or hex code of color",
"type": "string"
"example": "#4169e1, royalblue",
"type": "string",
"default": "#000000",
"suggested": true,
"aliases": [
"color"
]
}
}
},
},
"description": "For putting main colors in."
"description": "This template generates a stylized color box that displays a color name or value in that color alongside a matching swatch, automatically selecting a light or dark background to ensure the color name remains legible for all colors.",
"format": "inline"
}
}
</templatedata>
</templatedata>