Difference between revisions of "Template:Color Icons"

From mtgpq wiki
Jump to: navigation, search
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
==Usage==
 
==Usage==
Replace a string representing one or more colours with a series of icons.
+
Given a string of 1 to 5 letters representing colors, produces a corresponding series of space-separated color icons.
  
 
The template parameter is a sequence of upper-case letters from the set WUBRGCL.
 
The template parameter is a sequence of upper-case letters from the set WUBRGCL.
Line 17: Line 17:
 
[[Category:Symbol templates]]
 
[[Category:Symbol templates]]
  
</noinclude><includeonly>{{nowrap|{{replace|{{replace|{{replace|{{replace|{{replace|{{replace|{{replace|
+
</noinclude><includeonly><!--
{{{1}}}
+
-->{{ {{#invoke:String|sub|{{{1}}}|1|1}} }}<!--
|W|{{W}} }}
+
-->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 1|&nbsp;{{ {{#invoke:String|sub|{{{1}}}|2|2}} }} }}<!--
|U|{{U}} }}
+
-->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 2|&nbsp;{{ {{#invoke:String|sub|{{{1}}}|3|3}} }} }}<!--
|B|{{B}} }}
+
-->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 3|&nbsp;{{ {{#invoke:String|sub|{{{1}}}|4|4}} }} }}<!--
|R|{{R}} }}
+
-->{{#ifexpr:{{#invoke:String|len|{{{1}}}}} > 4|&nbsp;{{ {{#invoke:String|sub|{{{1}}}|5|5}} }} }}<!--
|G|{{G}} }}
+
--></includeonly>
|C|{{C}} }}
 
|L|{{L}} }}
 
}}</includeonly>
 

Revision as of 03:53, 15 February 2019

Usage

Given a string of 1 to 5 letters representing colors, produces a corresponding series of space-separated color icons.

The template parameter is a sequence of upper-case letters from the set WUBRGCL.

Example

The following mark-up:

{{Color Icons|UBR}}

Produces:

BlueBlackRed