Difference between revisions of "Template:Color Icons"
Line 5: | Line 5: | ||
The first parameter is a sequence of upper-case letters from the set WUBRGCL. | 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 = | + | The second parameter (optional) is the size of the icons (default = 14). |
The third parameter (optional) is a wiki link for each icon (default: Mana). | The third parameter (optional) is a wiki link for each icon (default: Mana). | ||
Line 11: | Line 11: | ||
The fourth parameter (optional) is hover text for each icon (default: the full name of the color). | The fourth parameter (optional) is hover text for each icon (default: the full name of the color). | ||
− | The named "sep" parameter (optional) is the separator between icons. (Default: | + | The named "sep" parameter (optional) is the separator between icons. (Default: '') |
==Example== | ==Example== | ||
The following mark-up: | The following mark-up: | ||
<pre><nowiki> | <pre><nowiki> | ||
− | {{Color Icons|UBR|24}} | + | {{Color Icons|UBR} |
+ | {{Color Icons|UBR|24|sep=&thinsp;}} | ||
</nowiki></pre> | </nowiki></pre> | ||
Produces: | Produces: | ||
− | {{Color Icons|UBR|24}} | + | {{Color Icons|UBR}} |
+ | |||
+ | {{Color Icons|UBR|24|sep= }} | ||
[[Category:Symbol templates]] | [[Category:Symbol templates]] | ||
</noinclude><includeonly>{{#ifeq:{{#invoke:String|sub|{{{1}}}|1|1}}|[||<!-- | </noinclude><includeonly>{{#ifeq:{{#invoke:String|sub|{{{1}}}|1|1}}|[||<!-- | ||
− | -->{{nowrap|{{Symbol|{{#invoke:String|sub|{{{1}}}|1|1}}|{{{2| | + | -->{{nowrap|{{Symbol|{{#invoke:String|sub|{{{1}}}|1|1}}|{{{2|14}}}|{{{3|}}}|{{{4|}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 1|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep| | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 1|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep|}}}</span>|{{{sep|}}}}}]]|{{{sep|}}}}}{{Symbol|{{#invoke:String|sub|{{{1}}}|2|2}}|{{{2|14}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 2|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep| | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 2|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep|}}}</span>|{{{sep|}}}}}]]|{{{sep|}}}}}{{Symbol|{{#invoke:String|sub|{{{1}}}|3|3}}|{{{2|14}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 3|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep| | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 3|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep|}}}</span>|{{{sep|}}}}}]]|{{{sep|}}}}}{{Symbol|{{#invoke:String|sub|{{{1}}}|4|4}}|{{{2|14}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
− | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 4|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep| | + | -->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 4|{{#if:{{{3|}}}|[[{{{3}}}|{{#if:{{{4|}}}|<span title="{{{4|}}}">{{{sep|}}}</span>|{{{sep|}}}}}]]|{{{sep|}}}}}{{Symbol|{{#invoke:String|sub|{{{1}}}|5|5}}|{{{2|14}}}|{{{3|}}}|{{{4|}}}}}}}<!-- |
-->}}}}</includeonly> | -->}}}}</includeonly> |
Revision as of 11:15, 28 April 2020
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 = 14).
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).
The named "sep" parameter (optional) is the separator between icons. (Default: )
Example
The following mark-up:
{{Color Icons|UBR} {{Color Icons|UBR|24|sep= }}
Produces: