Changes

Jump to: navigation, search

Template:Colors expand

769 bytes added, 01:04, 22 February 2019
no edit summary
==Usage==
Expands a string containing 1 to 5 one-letter color abbreviations into a comma-separated list of the colours as words.
 
The optional second parameter is either "and" or "or", for using a list of color names in a sentence.
==Example==
<pre><nowiki>
{{Colors expand|UBR}}
 
{{Colors expand|WR|or}}
</nowiki></pre>
{{Colors expand|UBR}}
 
{{Colors expand|WR|or}}
</noinclude><includeonly><!--
-->{{#switch:{{#invoke:String|len|{{{1}}}}}| 1 = {{Color expand|{{#invoke:String|sub|{{{1}}}|1|1}}}}| 2 = {{Color expand|{{#invoke:String|sub|{{{1}}}|1|1}}}}<!---->{{#ifexprif:{{{2|}}}|&nbsp;{{{2}}}&nbsp;|,&nbsp;}}<!---->{{Color expand|{{#invoke:String|lensub|{{{1}}}|2|2}}}}| 3 = {{Color expand|{{#invoke:String|sub|{{{1}}} > |1|1}}}}, <!---->{{Color expand|{{#invoke:String|sub|{{{1}}}|2|2}}}}, <!---->{{#if:{{{2|}}}|{{{2}}}&nbsp;}}<!---->{{Color expand|{{#ifexprinvoke:String|sub|{{{1}}}|3|3}}}}| 4 = {{Color expand|{{#invoke:String|lensub|{{{1}}}|1|1}} }}, <!----> {{Color expand|{{#invoke:String|sub|{{{1}}}|2|2}}}}, <!---->{{Color expand|{{#invoke:String|sub|{{{1}}}|3|3}}}}, <!---->{{#if:{{{2|}}}|{{{2}}}&nbsp;}}<!---->{{Color expand|{{#ifexprinvoke:String|sub|{{{1}}}|4|4}}}}| 5 = {{Color expand|{{#invoke:String|lensub|{{{1}}}|1|1}}} }, <!----> 3|, {{Color expand|{{#invoke:String|sub|{{{1}}}|42|4}}2}}}}, <!---->{{#ifexpr:Color expand|{{#invoke:String|lensub|{{{1}}}|3|3}}}} , <!----> 4|, {{Color expand|{{#invoke:String|sub|{{{1}}}|54|4}}}}, <!---->{{#if:{{{2|5}}}|{{{2}}}&nbsp;}}<!---->{{Color expand|{{#invoke:String|sub|{{{1}}}|5|5}}}}}}</includeonly>

Navigation menu