Template:Background

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

For use on Image pages to show the image with a different background.

Usage
  • {{Background|<image name>|<size>|<caption>|background=<color>}}
  • {{Background|<image name>|<size>|<caption>|bgcolor=<color>}}
  • {{Background|<image name>|<size>|<caption>|bg=<color>}}
  • {{Background|[[File:<image name>|<size>|<caption>]]|background=<color>}}
  • {{Background|[[File:<image name>|<size>|<caption>]]|bgcolor=<color>}}
  • {{Background|[[File:<image name>|<size>|<caption>]]|bg=<color>}}

Using either one of them is fine, all deliver identical results. You can also pass the known "thumb" attributes in combination with "left" or "right" for the alignment:

  • {{Background|<image name>|<size>|thumb|right|<caption>|background=<color>}}
  • {{Background|<image name>|<size>|thumb|left|<caption>|background=<color>}}
  • {{Background|[[File:<image name>|<size>|thumb|right|<caption>]]|background=<color>}}
  • {{Background|[[File:<image name>|<size>|thumb|left|<caption>]]|background=<color>}}
white circle
white circle
Examples
  • size defaults to the full width of the image (just like [[File:.. does) and
    background color defaults to #E0E0E0 (i.e. the default for location maps).
  • {{Background|Cercle blanc 100%.svg|white circle|right|background=black}} gives the result to the right, demonstrating size default value
  • {{Background|Cercle blanc 100%.svg|thumb}} results in the lower view to the right, using background color default value
Template:Background invokes Module:Background to do the heavy lifting
white circle on green ground
pink
Wrapped Syntax Example

You can also just wrap a usual Image Definition, and pass it as 1st positional parameter, ..

  • {{Background|[[File:Cercle blanc 100%.svg|120px|white circle on green ground|thumb|left]]|background=green}}

.. which has the same effect as using these two variants:

  • {{Background|Cercle blanc 100%.svg|120px|white circle on green ground|thumb|left|background=green}}
  • {{Background|Cercle blanc 100%.svg|size=120px|caption=white circle on green ground|thumb=1|align=left|background=green}}



Using the same caption as the color spec e.g. works like this:

  • {{Background|[[File:Cercle blanc 100%.svg|120px|pink|thumb|right|]]|background=pink}}
white circle
Further examples

Wikilinks in captions to a thumb are also possible:

  • {{Background|[[File:Cercle blanc 100%.svg|120px|thumb|left|[[:File:Cercle blanc 100%.svg]]]]|background=#aaaaff}}
  • {{Background|Cercle blanc 100%.svg|120px|thumb|left|caption=white circle|background=red}}

Note: Currently a caveat left is support of setting the background for Images embedded using the <imagemap> extension; naturally it has the same stock limitation like File/Image does..

See also[edit]