Template:Legend
Please test any changes in the template's /sandbox (edit) and consider discussing changes at the talk page before implementing them. |
Can be used to create a map legend entry. The box size is about 32×21px and cannot be altered.
Usage
{{Legend |1= |2= }}
- Getting the color codes
At these tables you may see 16 × 16 × 16 colors, to be specified with #rgb and to be copied from there.
Here follows an example of how to get the color codes by using the freeware IrfanView. First, save the legend image(s) from the source. Open an image with Irfanview. Go to image menu/palette/ and click on "edit palette." Then from the dialog box of color squares that comes up click on the color of interest. The needed color code (value) will show up at the bottom of the dialog box after "HTML". It is the hexadecimal color code consisting of 6 characters or numbers. Copy it into the legend template. See also {{Xconv}}.
Many other image editors have a similar "color picker" tool (e.g. The GIMP, Paint.net, etc. or commercial products like Photoshop), but beware:
- Don't use the "Paint" accessory of old versions of Windows if it cannot read the original graphics file format (you can use it only on Windows versions that can read the PNG thumbnails generated by the image server on Commons, and can load this image with its native 24-bit or 32-bit "true" colors). If you have such old version of Windows, please use some other paint tool.
- Don't use image converters, or screen capture tools to save a screenshot of the image rendered in your browser, because the browser may have altered the rendered image (e.g. with dithering, or modified color gamut according to your local display settings and preferences) and because the screen capture tool may want to save the image in some "optimized" palette (different from the original) or may also dither the saved image in this generated palette.
Examples
{{Legend | #F00 | red box| css="title="the color is '#F00'}} |
red box |
{{Legend | | 1px blue line | line=1px solid blue}} |
1px blue line |
{{Legend | | 2px blue dotted line | line=2px dotted blue}} |
2px blue dotted line |
{{Legend | gold | 22px red dotted line | line=22px dotted red}} |
22px red dotted line |
{{Legend | #CFF | 4px blue double line | line=4px double blue}} |
4px blue double line |
{{Legend | | symbol as file | file=City locator 1.svg}} |
symbol as file |
{{Legend | #C0C0C0 | grey character β | char=β}} |
grey character β |
{{Legend | blue | line of little blue crosses | smallchar=xxxxx}} |
line of little blue crosses |
{{Legend | blue | a triple line composed of unicode symbol for identity | char=≡≡≡≡≡ | css=margin-left:-.2em;letter-spacing:-.3em;}} |
a triple line composed of unicode symbol for identity |
{{Legend | #90DD90 | Green with 3px solid brown border | css=border:3px solid #803030}} |
Green with 3px solid brown border (#803030) |
{{Legend | #C0EEC0 | 2px green dotted border | css=border:2px dotted #408040}} |
2px green dotted border (#408040) |
{{Legend | white | 2px green dashed border | css=border:2px dashed #408040"title="blanc}} |
2px green dashed border (#408040) |
{{Legend | #EAECF0 | 1px gray border like wikitable | css=border:1px solid #A2A9B1}} |
1px gray border (#A2A9B1, like wikitable class) |
{{Legend | red | striped in red, width 1 (with {{F|SVGstripes1.svg|1}}) | striped=1}} | 1)
striped in red, width 1 (with |
{{Legend | blue | striped in blue, width 2 (...) | striped=2 | css=opacity:.5"title="semi}} | 2)
striped in blue, width 2 (with |
{{Legend | yellow | striped in yellow, width 3 (...) | striped=3}} | 3)
striped in yellow, width 3 (with |
———————————————————————————————————————————————— | —————————————— |
{{Legtab}} or {{ColorString}}: | Legend tables transcluded bypossibility for more fields, separated by slashes or pipes |
{{ Legtab | E)#CFC | light green color, striped with {{F|SVGstripesE.svg|E}} }}: | light green color, striped with |
———————————————————————————————————————————————— | |
{{ Legtab | #0f47af/azure/#DA121A/gules/#999/cendrée }}: | azure gules
cendrée |
———————————————————————————————————————————————— | |
{{ Legtab | #069 | wmb | none | {{0}} | #396 | wmg | none | (gap) | wmr | wmr }}: |
"none" makes exactly nothing in the exact size of a box (but can display text, if any)
wmb wmg (gap)
wmr |
———————————————————————————————————————————————— | |
{{Legend-line}}s within a legend table: {{ Legtab | //#396/land/#03C solid 3px/river/#030 dashed 2px/border/#06F/sea/12px #D00 dotted/dot }}: (precede with two slashes to set the lines width) |
land river border sea dot
|
———————————————————————————————————————————————— | |
Bordered Legends: {{ Legtab | //lime #F00 solid .5px/ /E)Orchid Navy solid 2px/ /gules white solid 6px/ }} |
lime Orchid
gules |
Template parameters
Parameter | Description | Default | Status | |
---|---|---|---|---|
1 | color (CSS colors list) or "transparent " | white | required | |
2 | caption | empty | required | |
char | character or string to display | empty | optional | |
file | file to display | empty | optional | |
smallchar | character or string, just as char but smaller and bold | empty | optional | |
line | CSS border statement (CSS border Property) rendered as a single line | empty | optional | |
css | CSS statement to apply to the box, e.g. css=opacity:.25 and/or e.g. css="title="any_text | empty | optional | |
size | size of the file in px (e.g. "20x20"; no "px" at the end) | 15x15 | optional | |
border | border: (either "1px solid gray " or "none ") | depends | deprecated | |
striped | width of the stripes, either 1, 2, or 3 another possibility to define stripes is to prefix parameter 1 with 1) 2) 3) | empty | optional | |
lang | language code, used to determine the layout direction (ltr or rtl). If not specified, the layout will be ltr (left-to-right) by default. | empty | optional | |
style | overrides the default style of display:block | empty | optional |
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Localization
This template is not intended to be localized.
See also
- {{Legend-small}}, a copy of {{Legend}} from Wikipedia, which appearance is different than {{Legend}} on Commons (smaller boxes)
- {{Legend-shell}}, additional formatting around legends
- {{Legend-table}}, with additional title (aligned, translated; noted)
- {{Legend-line}}, shows a legend row with a line (colored, dotted, … )
- {{Legend sliced}}, shows a legend row with a two-colored box
- {{Leglin}}, a super template for other legends, using Module:Iteration
- {{Legtab}}, a super template for many legends, using (with the default function)
- {{ColorString}}
- {{Scale missing}}, for images that should have a legend but currently don't