background-color is passed to theCSS background-color property of the color box.
The optionaloutline parameter is the color of the outline around the box. Not to be confused with the CSS outline property.
The optionalborder argument which overrides theoutline argument and sets the CSS property (e.g.,1px solid #aaa) of the border that will be drawn around the box.
Examples
Use in text
{{legend|black|Africa|outline=gray}}{{legend|green|Americas}}{{legend|blue|Oceania}}{{legend|#ffa|Europe|outline=silver}}{{legend|#ff2800|Asia|outline=#A2A9B1}}<!-- #A2A9B1 is the [[Help:Basic table markup|wikitables]] border color. -->
Africa
Americas
Oceania
Europe
Asia
Use in captions
Markup
Renders as
[[File:Celts in Europe.png|upright=.9|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}}{{legend|#D2FFD2|Lusitanian area of Iberia, "Celticity" uncertain}}{{legend|yellow|The core Hallstatt territory, expansion before 500 BC}}]]
The Celts in Europe, past and present:
Present-day Celtic-speaking areas
Other parts of the six most commonly recognized "Celtic nations" and where a Celtic language is spoken but not the dominating language
Other parts of Europe once peopled by Celts; modern-day inhabitants of many of these areas often claim a Celtic heritage and/or culture
Lusitanian area of Iberia, "Celticity" uncertain
The core Hallstatt territory, expansion before 500 BC
Use with all parameters exceptalt andinvert
{{legend| #ded<!--light green-->| The meadow is green.| outline= #00e<!--blue >> will be not used because overridden by border-parameter-->| border= 2px solid #e00<!--red-->| textcolor= #00e<!--blue-->| size= 200%| text= green}}
green The meadow is green.
Invert in dark mode
This is only for thedark mode; nothing happens in the built-indark mode since table colors are not inverted.
{{legend| [legend box's colo(u)r]| [text following legend box]| invert=<!--Invert the color swatch in dark mode-->| outline=<!--colo(u)r of border around legend box-->| border=<!--use to specify custom CSS styling for border (overrides 'outline')-->| textcolor=<!--colo(u)r of 'text'-->| size=<!--'text' font-size-->| text=<!--to place text inside the legend box-->| alt=<!--to place invisible text inside the legend box (overrides 'text')-->}}
Limitations
Using certain special characters in|text= that have meaning in wikitext can cause unexpected results. To use * in|text=, use|text={{asterisk}}. To use # in|text=, use|text={{number sign}}.
Determine hex colors for legend
One way to determine the exact color is via freewareIrfanView. Open image. Then:
Edit menu > Show Paint dialog > click on the eyedropper > click somewhere in the image > click on the color at the bottom of the Paint dialog > Write down the Red, Green, and Blue color numbers (RGB).
Online sites that can identify the color of any pixel in an uploaded image are also available: