• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Beta Wikipedia

Template:Legend

  • Template
  • Discussion
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on approximately 17,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.

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

edit
{{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

edit

Use in text

edit
{{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

edit
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

Full parameter list

edit
{{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

edit

Using certain special characters in |text= that have meaning in wikitext can cause unexpected results. To use Template:Asterisk in |text=, use |text={{asterisk}}. To use # in |text=, use |text={{number sign}}.

See also

edit
  • 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

edit
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 "https://en.wikipedia.beta.wmcloud.org/w/index.php?title=Template:Legend&oldid=584517"
Last edited on 3 May 2023, at 12:27

Languages

      This page is not available in other languages.

      Beta Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited 12:27, 3 May 2023 by Beta Wikipedia user Seddon. Based on work by Beta Wikipedia users Dom walden, Polishdeveloper, محمد شعیب, JustBerry, Edokter, Geraki, Petrb and Zzuuzz and Beta Wikipedia anonymous users testwiki>Reinhard Kraasch, wikipedia:en>TheDJ, testwiki>Seddon (WMF), en>Nihiltres, en>TheDJ, testwiki>Lemondoge, imported>WOSlinker, en>Redrose64, imported>Rambo's Revenge, imported>Zocky, imported>Cenarium, imported>Maelgwnbot, imported>Circeus, imported>Davidgothberg, imported>Tariqabjotu, imported>FordPrefect42, imported>Yug, imported>BenoniBot, imported>Tomtheman5, imported>Петър Петров, imported>Deror avi, 89.137.38.132, imported>Snowdog, imported>John Quincy Adding Machine, imported>David Kernow, imported>Guitardemon666, 89.173.17.101, imported>Ligulem, 84.73.52.213, 213.168.66.98, imported>Desiphral, imported>Ed g2s, imported>XJamRastafire, 172.176.140.35, imported>Alsandro, imported>DeansFA, 83.247.136.72, imported>Adam7davies, 222.166.160.49, 62.183.50.164, imported>Adam78, imported>Interiot, imported>PuzzletChung, imported>Nightstallion, imported>Wangi, imported>Hdante, imported>Mxn, 84.6.46.49, imported>Szym, imported>Obradovic Goran, 141.35.17.32, 84.59.23.255 and imported>Commander Keane.
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of use
      • Desktop