imported>Koanyan5028 Created page with "<span style="color:{{Stat Color|defense}}">Defense</span> <span style="color:{{Stat Color|speed}}">Speed</span> This template returns color code corresponding to the stat specified through argment. This template is not case sensitive, so "speed", "Speed" and "SPEED" works exactly same when passed as a template argment. ==Examples== Code: <nowiki> {{Stat Color|speed}}</nowiki> Result: <nowiki> #55ff55</nowiki> ---- Code: <nowiki> <span style="color:{{Stat Color|..." |
the mass documenting |
||
| Line 1: | Line 1: | ||
< | '''<code>Template:Stat Color</code> returns the standard hex colour code for a named stat, so stat colours stay consistent everywhere on the wiki.''' | ||
__TOC__ | |||
< | == Overview == | ||
This template takes a stat name as its first unnamed parameter and outputs only a hex colour code (e.g. <code>speed</code> → <code>#55ff55</code>). It outputs nothing visible on its own — you place it inside a <code>style="color:..."</code> attribute or pass it to another template. It is case-insensitive and accepts several aliases. Unknown names fall back to white (<code>#ffffff</code>). It is used by [[Template:Stat Bar]] (and therefore [[Template:Stat Table]]) to colour stat bars. | |||
== Parameters == | |||
{| class="wikitable" | |||
! Parameter !! Required? !! What it does !! Example | |||
|- | |||
| <code>1</code> (first unnamed parameter) || Required || The stat name to look up. Recognised values (case-insensitive): <code>defense</code>/<code>defence</code> → #5555ff; <code>attack</code> → #55ffff; <code>speed</code> → #55ff55; <code>evasion</code> → #ffff55; <code>health</code> → #ff5555; <code>vitality</code> → #ff55ff; <code>crit</code>/<code>critical</code>/<code>crit chance</code>/<code>critical chance</code>/<code>critchance</code>/<code>criticalchance</code> → #aa00aa. Anything else returns #ffffff (white). || <code>{{Stat Color|speed}}</code> | |||
|} | |||
== How to use == | |||
1. Write <code><nowiki>{{Stat Color|</nowiki></code> followed by the stat name, then <code><nowiki>}}</nowiki></code>. | |||
2. Put that wherever a colour value is expected — most often inside a span style. | |||
Special-syntax notes: the name is the first ''positional'' argument (no <code>name=</code>), and it is not case-sensitive, so <code>speed</code>, <code>Speed</code> and <code>SPEED</code> all return the same colour. Several aliases map to the same colour (e.g. <code>defense</code> and <code>defence</code>; the six crit spellings). A name the template doesn't recognise returns white rather than an error. | |||
== | == Copy this == | ||
<syntaxhighlight lang="wikitext" style="overflow:auto;"> | |||
<span style="color:{{Stat Color|}}">your text</span> | |||
{{Stat Color| | </syntaxhighlight> | ||
== Example == | |||
Live result: | |||
<span style="color:{{Stat Color|attack}}">Attack</span> | |||
Wikitext that produced it: | |||
<syntaxhighlight lang="wikitext" style="overflow:auto;"> | |||
<span style="color:{{Stat Color|attack}}">Attack</span> | |||
</syntaxhighlight> | |||
< | |||
Used on its own, it just emits the code: | |||
< | <syntaxhighlight lang="wikitext" style="overflow:auto;"> | ||
{{Stat Color|speed}} produces: #55ff55 | |||
</ | </syntaxhighlight> | ||
== Tips & notes == | |||
* Case doesn't matter; aliases exist for defence/defense and for the six crit spellings. | |||
* Unrecognised names return <code>#ffffff</code> (white), not an error — double-check spelling if a colour comes out white unexpectedly. | |||
* The template emits ''only'' the hex code, so always wrap it in something that consumes a colour (e.g. <code>style="color:..."</code>). | |||
* Related: [[Template:Stat Bar]] and [[Template:Stat Table]] both rely on this for their colours. | |||
: | |||
: | |||
Latest revision as of 11:55, 20 June 2026
Template:Stat Color returns the standard hex colour code for a named stat, so stat colours stay consistent everywhere on the wiki.
Overview
This template takes a stat name as its first unnamed parameter and outputs only a hex colour code (e.g. speed → #55ff55). It outputs nothing visible on its own — you place it inside a style="color:..." attribute or pass it to another template. It is case-insensitive and accepts several aliases. Unknown names fall back to white (#ffffff). It is used by Template:Stat Bar (and therefore Template:Stat Table) to colour stat bars.
Parameters
| Parameter | Required? | What it does | Example |
|---|---|---|---|
1 (first unnamed parameter) |
Required | The stat name to look up. Recognised values (case-insensitive): defense/defence → #5555ff; attack → #55ffff; speed → #55ff55; evasion → #ffff55; health → #ff5555; vitality → #ff55ff; crit/critical/crit chance/critical chance/critchance/criticalchance → #aa00aa. Anything else returns #ffffff (white). |
|
How to use
1. Write {{Stat Color| followed by the stat name, then }}.
2. Put that wherever a colour value is expected — most often inside a span style.
Special-syntax notes: the name is the first positional argument (no name=), and it is not case-sensitive, so speed, Speed and SPEED all return the same colour. Several aliases map to the same colour (e.g. defense and defence; the six crit spellings). A name the template doesn't recognise returns white rather than an error.
Copy this
<span style="color:{{Stat Color|}}">your text</span>Example
Live result:
Attack
Wikitext that produced it:
<span style="color:{{Stat Color|attack}}">Attack</span>Used on its own, it just emits the code:
{{Stat Color|speed}} produces: #55ff55Tips & notes
- Case doesn't matter; aliases exist for defence/defense and for the six crit spellings.
- Unrecognised names return
#ffffff(white), not an error — double-check spelling if a colour comes out white unexpectedly. - The template emits only the hex code, so always wrap it in something that consumes a colour (e.g.
style="color:..."). - Related: Template:Stat Bar and Template:Stat Table both rely on this for their colours.