Difference between revisions of "Template:Color Icons"
Line 6: | Line 6: | ||
The second parameter (optional) is the size of the icons (default = 15). | The second parameter (optional) is the size of the icons (default = 15). | ||
+ | |||
+ | The third parameter (optional) is a wiki link for each icon (default: Mana). | ||
+ | |||
+ | The fourth parameter (optional) is hover text for each icon (default: the full name of the color). | ||
==Example== | ==Example== | ||
Line 20: | Line 24: | ||
</noinclude><includeonly><!-- | </noinclude><includeonly><!-- | ||
− | -->{{nowrap|{{Symbol|{{#invoke:String|sub|{{{1}}}|1|1}}|{{{2|15}}}}}<!-- | + | -->{{nowrap|{{Symbol|{{#invoke:String|sub|{{{1}}}|1|1}}|{{{2|15}}}|{{{3|}}}|{{{4|}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 1| {{Symbol|{{#invoke:String|sub|{{{1}}}|2|2}}|{{{2|15}}}}}}}<!-- | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 1|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}"> </span>| }}]]| }}{{Symbol|{{#invoke:String|sub|{{{1}}}|2|2}}|{{{2|15}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 2| {{Symbol|{{#invoke:String|sub|{{{1}}}|3|3}}|{{{2|15}}}}}}}<!-- | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 2|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}"> </span>| }}]]| }}{{Symbol|{{#invoke:String|sub|{{{1}}}|3|3}}|{{{2|15}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 3| {{Symbol|{{#invoke:String|sub|{{{1}}}|4|4}}|{{{2|15}}}}}}}<!-- | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 3|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}"> </span>| }}]]| }}{{Symbol|{{#invoke:String|sub|{{{1}}}|4|4}}|{{{2|15}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 4| {{Symbol|{{#invoke:String|sub|{{{1}}}|5|5}}|{{{2|15}}}}}}}<!-- | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 4|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}"> </span>| }}]]| }}{{Symbol|{{#invoke:String|sub|{{{1}}}|5|5}}|{{{2|15}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
-->}}</includeonly> | -->}}</includeonly> |
Revision as of 07:52, 27 March 2019
Usage
Given a string of 1 to 5 letters representing colors, produces a corresponding series of space-separated color icons.
The first parameter is a sequence of upper-case letters from the set WUBRGCL.
The second parameter (optional) is the size of the icons (default = 15).
The third parameter (optional) is a wiki link for each icon (default: Mana).
The fourth parameter (optional) is hover text for each icon (default: the full name of the color).
Example
The following mark-up:
{{Color Icons|UBR|24}}
Produces: