• Home
  • Random
  • Log in
  • Settings
  • About Ethan's Workspace
  • Disclaimers
Ethan's Workspace

Template:Legend

  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]

Lua error in Module:TNT at line 167: Missing Commons dataset I18n/Module:TNT.tab. Shows a legend row with a colored box.

Contents

  • 1 Usage
  • 2 Examples
    • 2.1 Use in text
    • 2.2 Use in captions
  • 3 Full parameter list
  • 4 Limitations
  • 5 See also
  • 6 TemplateData

Usage

{{legend|background-color|caption|outline=outline color|border=css border}}
  • background-color is passed to the css background-color property of the color box.
  • The optional outline parameter is the color of the outline around the box.
  • The optional border argument which overrides the outline argument and sets 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|#ffa|Europe|outline=silver}}
{{legend|#ff2800|Asia|outline=#A2A9B1}}  (#A2A9B1 is the wikitables border color.)
  Africa
  Americas
  Oceania
  Europe
  Asia

Use in captions

Markup Renders asLua error: expandTemplate: template "format item" does not exist.

Full parameter list

{{legend
| [legend box's colo(u)r]
| [text following legend box]
| outline =  <!--colo(u)r of border around legend box-->
| border =   <!--use to specify custom CSS styling for border (overrides 'outline')-->
| color =    <!--colo(u)r of 'text'-->
| size =     <!--'text' font-size-->
| text =     <!--to place text inside the legend box-->
}}

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}}.

See also

  • Variant blocks
    • {{legend striped}}, two colors, for striped color areas
    • {{legend inline}}, uses display:inline to avoid line breaks after each legend
    • {{legend0}}, without the line-feed
    • {{leftlegend}}, with text-align set to left
    • {{color box}} and {{RouteBox}}, with text placed inside the colored legend and article linking
  • {{legend-line}}, legends for lines
  • {{image key}}, allows legend templates being used in image captions to use multiple columns
  • Lists of colors
  • Web colors

Templates that list colors

  • {{Colornames}}
  • {{X11 color chart}}
  • {{Web Colors}}

TemplateData

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Legend in articles based on its TemplateData.

TemplateData for Legend

Shows a legend row with a colored box and a caption.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Color1

The color for the legend entry, in any CSS format

Example
"#6D6E00", "#ffa", "yellow"
Linerequired
Caption2

Label for the legend entry

Example
"soda" is most common
Stringsuggested
CSS border styleborder

CSS style for the legend entry's border

Stringoptional
Entry outlineoutline

CSS color for the outline of the legend entry

Example
silver
Lineoptional
Text in the entrytext

Text to be displayed in the legend entry box, i.e. within the color specified

Example
Af
Lineoptional
Text colortextcolor

CSS color of text inside the legend's colored box

Stringoptional
Sizesize

Font size of the legend entry, including colored box

Stringoptional
The above documentation is transcluded from Template:Legend/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "http://ethans-workspace.com/w/index.php?title=Template:Legend&oldid=2665"
Last edited on 5 August 2022, at 17:01

Languages

    This page is not available in other languages.

    Ethan's Workspace
    • This page was last edited on 5 August 2022, at 17:01.
    • Privacy policy
    • About Ethan's Workspace
    • Disclaimers
    • Desktop