Template:Legend: Difference between revisions
Jump to navigation
Jump to search
>Izno (remove unnecessary vendor CSS) |
mp>Paine Ellsworth (per edit request on talk page made 11 May 2021 - xfer code from sandbox) |
||
Line 1: | Line 1: | ||
<includeonly><!-- | <includeonly><!-- | ||
--><templatestyles src="Legend/styles.css" /><!-- | --><templatestyles src="Legend/styles.css" /><!-- | ||
--><div class="legend"><span class="legend-color" style="<!-- | --><div class="legend"><!-- | ||
-->{{#if:{{{border|}}}|border: {{{border}}};|{{#if:{{{outline|}}}|border: 1px solid {{{outline}}};}}}} <!-- | --><span class="legend-color" style="<!-- | ||
-->{{#if:{{{border|}}}|border: {{{border}}};|{{#if:{{{outline|}}}|border: 1px solid {{{outline}}};}}}}<!-- | |||
-->{{#if:{{{1|}}}|{{greater color contrast ratio|{{{1}}}|white|black|css=y}}}}<!-- | -->{{#if:{{{1|}}}|{{greater color contrast ratio|{{{1}}}|white|black|css=y}}}}<!-- | ||
-->{{#if:{{{textcolor|}}}|color:{{{textcolor}}};}}<!-- | -->{{#if:{{{textcolor|}}}|color:{{{textcolor}}};}}<!-- | ||
-->{{#if:{{{size|}}}|font-size:{{{size}}};}}"><!-- | -->{{#if:{{{size|}}}|font-size:{{{size}}};}}"><!-- | ||
-->{{#if:{{{text|}}}|<span class="legend-text">{{{text}}}</span>| }}</span><!-- | |||
--> {{{2|}}}</div><!-- | -->{{#if:{{{text|}}}{{{alt|}}} | ||
--></includeonly><noinclude>{{Documentation}}</noinclude> | | <span class="legend-text" style="{{#if:{{{alt|}}}|color:{{{1|}}};}}font-family: monospace, monospace;">{{If empty|{{{alt|}}}|{{{text|}}}| }}</span>| }}<!-- | ||
--></span><!-- | |||
--> {{{2|}}}<!-- | |||
--></div><!-- | |||
--></includeonly><noinclude> | |||
{{Documentation}} | |||
</noinclude> |
Revision as of 07:43, 21 July 2021
Shows a legend row with a colored box.
Usage
{{legend|color|label|border=border}}
color is passed to the css background-color property. The optional border argument is the css description (e.g. 1px solid #aaa
) of the border that will be drawn around the box.
Examples
Use in text
{{legend|black|Africa}} {{legend|green|Americas}} {{legend|blue|Oceania}} {{legend|#ff0|Europe}} {{legend|#ff2800|Asia}}
Africa
Americas
Oceania
Europe
Asia
[[Image:Celts in Europe.png|200px|thumb|right|The Celts in Europe, past and present: {{legend|#1a8000|present-day Celtic-speaking areas}} {{legend|#27c600|other parts of the six most commonly recognized 'Celtic nations' and where a Celtic language is spoken but not the dominating language}} {{legend|#97ffb6|other parts of Europe once peopled by Celts; modern-day inhabitants of many of these areas often claim a Celtic heritage and/or culture}} ]]