imported>Koanyan5028
Created page with "<includeonly>{{#switch: {{lc: {{{1}}} }} | defense | defence=#5555ff | attack=#55ffff | speed=#55ff55 | evasion=#ffff55 | health=#ff5555 | vitality=#ff55ff | crit | critical | crit chance | critical chance | critchance | criticalchance=#aa00aa | #default=#ffffff }}</includeonly><noinclude> <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..."
 
imported>Koanyan5028
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
| criticalchance=#aa00aa
| criticalchance=#aa00aa
| #default=#ffffff
| #default=#ffffff
}}</includeonly><noinclude>
}}</includeonly><noinclude>{{Documentation}}</noinclude>
<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|attack}}">
Attack
</span></nowiki>
Result:
: <span style="color:{{Stat Color|attack}}">Attack</span>
 
 
----
Code:
<nowiki>
<!-- This template is not case-sensitive -->
 
<span style="color:{{Stat Color|defense}}">
defense
</span>
 
<span style="color:{{Stat Color|Defense}}">
Defense
</span>
 
<span style="color:{{Stat Color|DEFENSE}}">
DEFENSE
</span></nowiki>
Result:
: <span style="color:{{Stat Color|defense}}">defense</span>
: <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:52, 28 October 2024

Documentation Edit this documentation at Template:Stat_Color/doc.
(edithistorypurge)

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.