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:
<span style="color:{{Stat Color|defense}}">Defense</span>
'''<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__


<span style="color:{{Stat Color|speed}}">Speed</span>
== 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>
|}


This template returns color code corresponding to the stat specified through argment.
== 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.


This template is not case sensitive, so "speed", "Speed" and "SPEED" works exactly same when passed as a template argment.
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.


==Examples==
== Copy this ==
Code:
<syntaxhighlight lang="wikitext" style="overflow:auto;">
<nowiki>
<span style="color:{{Stat Color|}}">your text</span>
{{Stat Color|speed}}</nowiki>
</syntaxhighlight>
Result:
<nowiki>
#55ff55</nowiki>


== Example ==
Live result:


----
<span style="color:{{Stat Color|attack}}">Attack</span>
Code:
<nowiki>
<span style="color:{{Stat Color|attack}}">
Attack
</span></nowiki>
Result:
: <span style="color:{{Stat Color|attack}}">Attack</span>


Wikitext that produced it:


----
<syntaxhighlight lang="wikitext" style="overflow:auto;">
Code:
<span style="color:{{Stat Color|attack}}">Attack</span>
<nowiki>
</syntaxhighlight>
<!-- This template is not case-sensitive -->


<span style="color:{{Stat Color|defense}}">
Used on its own, it just emits the code:
defense
</span>


<span style="color:{{Stat Color|Defense}}">
<syntaxhighlight lang="wikitext" style="overflow:auto;">
Defense
{{Stat Color|speed}}   produces:  #55ff55
</span>
</syntaxhighlight>


<span style="color:{{Stat Color|DEFENSE}}">
== Tips & notes ==
DEFENSE
* Case doesn't matter; aliases exist for defence/defense and for the six crit spellings.
</span></nowiki>
* Unrecognised names return <code>#ffffff</code> (white), not an error — double-check spelling if a colour comes out white unexpectedly.
Result:
* The template emits ''only'' the hex code, so always wrap it in something that consumes a colour (e.g. <code>style="color:..."</code>).
: <span style="color:{{Stat Color|defense}}">defense</span>
* Related: [[Template:Stat Bar]] and [[Template:Stat Table]] both rely on this for their colours.
: <span style="color:{{Stat Color|Defense}}">Defense</span>
: <span style="color:{{Stat Color|DEFENSE}}">DEFENSE</span>
 
 
----
Code:
<nowiki>
<!-- Some aliases -->
 
<span style="color:{{Stat Color|defense}}">
Defense
</span>
 
<span style="color:{{Stat Color|defence}}">
Defence
</span>
 
 
 
<span style="color:{{Stat Color|crit}}">
Crit
</span>
 
<span style="color:{{Stat Color|critical}}">
Critical
</span>
 
<span style="color:{{Stat Color|crit chance}}">
Crit Chance
</span>
 
<span style="color:{{Stat Color|critical chance}}">
Critical Chance
</span>
 
<span style="color:{{Stat Color|critChance}}">
CritChance
</span>
 
<span style="color:{{Stat Color|criticalChance}}">
CriticalChance
</span></nowiki>
Result:
: <span style="color:{{Stat Color|defense}}">Defense</span>
: <span style="color:{{Stat Color|defence}}">Defence</span>
 
: <span style="color:{{Stat Color|crit}}">Crit</span>
: <span style="color:{{Stat Color|critical}}">Critical</span>
: <span style="color:{{Stat Color|crit chance}}">Crit Chance</span>
: <span style="color:{{Stat Color|critical chance}}">Critical Chance</span>
: <span style="color:{{Stat Color|critChance}}">CritChance</span>
: <span style="color:{{Stat Color|criticalChance}}">CriticalChance</span>

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).
  1. 55ff55

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:  #55ff55

Tips & 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.