Template:Rarity: Difference between revisions
Template page
More actions
Create Rarity template for consistent tier colours across the wiki |
m Fix: actually load Template:Rarity/styles.css -- the stylesheet existed but nothing was including it |
||
| Line 1: | Line 1: | ||
<includeonly>{{#switch:{{lc:{{{1|}}}}} | <includeonly><templatestyles src="Template:Rarity/styles.css" />{{#switch:{{lc:{{{1|}}}}} | ||
|common=<span class="loka-rarity loka-rarity--common" data-sort-value="1">{{{2|Common}}}</span> | |common=<span class="loka-rarity loka-rarity--common" data-sort-value="1">{{{2|Common}}}</span> | ||
|uncommon=<span class="loka-rarity loka-rarity--uncommon" data-sort-value="2">{{{2|Uncommon}}}</span> | |uncommon=<span class="loka-rarity loka-rarity--uncommon" data-sort-value="2">{{{2|Uncommon}}}</span> | ||
Revision as of 22:22, 22 August 2026
Usage
{{Rarity|Rare}}
renders as: Rare
The first parameter is the rarity tier (case-insensitive) -- common, uncommon, rare, epic, legendary, or mythic. Left at just that, it prints the tier's own name in its colour. An optional second parameter colours different text as that tier instead, e.g.:
{{Rarity|mythic|Ancient}}
renders as: Ancient
In a sortable wikitable column, sorts by actual rarity order (Common lowest, Mythic highest) rather than alphabetically on the displayed text -- nothing extra needed in the cell's own wikitext for this to work.
Colours
| Tier | Hex |
|---|---|
| Common | Common #FCFCFC |
| Uncommon | Uncommon #23F606 |
| Rare | Rare #00B0FC |
| Epic | Epic #B048F8 |
| Legendary | Legendary #FABA36 |
| Mythic | Mythic #E73521 |