Template:Rarity: Difference between revisions
Template page
More actions
Create Rarity template for consistent tier colours across the wiki |
m Replace reader-visible prose double hyphens with a proper em dash entity |
||
| (One intermediate revision by the same user not shown) | |||
| 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> | ||
| Line 14: | Line 14: | ||
renders as: {{Rarity|Rare}} | renders as: {{Rarity|Rare}} | ||
The first parameter is the rarity tier (case-insensitive) | The first parameter is the rarity tier (case-insensitive) — <code>common</code>, <code>uncommon</code>, <code>rare</code>, <code>epic</code>, <code>legendary</code>, or <code>mythic</code>. 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.: | ||
<pre>{{Rarity|mythic|Ancient}}</pre> | <pre>{{Rarity|mythic|Ancient}}</pre> | ||
| Line 20: | Line 20: | ||
renders as: {{Rarity|mythic|Ancient}} | renders as: {{Rarity|mythic|Ancient}} | ||
In a sortable wikitable column, sorts by actual rarity order (Common lowest, Mythic highest) rather than alphabetically on the displayed text | 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 == | == Colours == | ||
Latest revision as of 14:19, 23 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 |