Template:Legend

From Wikimedia Commons, the free media repository
Jump to: navigation, search
   {{{2}}}
Documentation icon Documentation[view] [edit] [history] [purge]

This documentation is transcluded from Template:Legend/doc.

Can be used to create a map legend entry. The box size is about 32×21px and cannot be altered.

Usage

{{Legend |1= |2= |char= |file= |smallchar= |line= |css= |size= |lang= }}

Getting the color codes

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.

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="color=#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||3px blue double line|line=3px double blue}}
   3px blue double line
{{Legend||symbol as file|file=City locator 1.svg}}
symbol as file  symbol as file
{{Legend|#C0C0C0|grey character β|char=β}}
β  grey character β
{{Legend|blue|line of little blue crosses|smallchar=xxxxx}}
xxxxx  line of little blue crosses
{{Legend|blue|a triple line composed of unicode symbol for identity|char=≡≡≡≡≡|css=letter-spacing:-2px;}}
≡≡≡≡≡  a triple line composed of unicode symbol for identity
{{Legend|#90DD90|Green with 3px solid brown border|css=border:3px solid #803030" title="color='#90DD90'}}
   Green with 3px solid brown border
{{Legend|#C0EEC0|2px green dotted border|css=border:2px dotted #408040" title="color=#C0EEC0}}
   2px green dotted border
{{Legend|white|2px green dashed border|css=border:2px dashed #408040" title="color=white}}
   2px green dashed border
{{Legend|red|striped in red, width 1|striped=1}}
striped in red, width 1  striped in red, width 1
{{Legend|blue|striped in blue, width 2|striped=2}}
striped in blue, width 2  striped in blue, width 2
{{Legend|yellow|striped in yellow, width 3|striped=3}}
striped in yellow, width 3  striped in yellow, width 3

Template parameters

Parameter Description Default Status
1 color ([1]) 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 ([2]) rendered as a single line empty optional
css CSS statement to apply to the box 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
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

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.