Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Template:Legend

Permanently protected template
From Wikipedia, the free encyclopedia
Template documentation[view] [edit] [history] [purge]
WarningThis template is used onapproximately 33,000 pages and changes may be widely noticed. Test changes in the template's/sandbox or/testcases subpages, or in your ownuser subpage. Consider discussing changes on thetalk page before implementing them.
CSSThis template usesTemplateStyles:

Shows a legend row with a colored box.

Usage

{{legend|background-color|caption|outline=outline color|border=css border|alt=alt text}}

  • 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

MarkupRenders 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|#FFC7C7|No|invert=yes}}{{legend|#FF8|Maybe|invert=yes}}{{legend|#9EFF9E|Yes|invert=yes}}
  No
  Maybe
  Yes

Full parameter list

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

ConvertRGB colors tohex color orcolor name (if there is one):

See also

  • Variant blocks
  • {{legend-line}}, legends for lines
  • {{image key}}, allows legend templates being used in image captions to use multiple columns

Templates that list colors

TemplateData

This is theTemplateData for this template used byTemplateWizard,VisualEditor and other tools.See a monthly parameter usage report forTemplate: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
Invert in dark modeinvert

Invert color swatch and its contents in dark mode (recommended for tables)

Stringoptional
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
Alt text of the entryalt

Adds hidden text to the legend entry box; overrides "text"

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 abovedocumentation istranscluded fromTemplate:Legend/doc.(edit |history)
Editors can experiment in this template'ssandbox(edit |diff) andtestcases(edit) pages.
Add categories to the/doc subpage.Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:Legend&oldid=1312290007"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp