Template:Colorbox

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

    

Template documentationview · edit · history · purge ]
This documentation is transcluded from Template:Colorbox/doc.

No description yet available.

Usage

{{Colorbox |1= |2= |3= |title= }}

Legends and keys

The colorbox template is widely used to annotate complex tables in which editors have used color to group like entries. The editor uses the background-color style to color individual cells in the table and then adds a legend consisting of colorboxes at the beginning or end of the table explaining the meanings behind the color scheme. The editor should also add symbols like a caret (^), dagger/obelisk (†), double dagger/diesis (‡), or asterisk (*) to call attention to the different meanings, and make the table accessible for the color blind and in other cases where colors are not available (e.g. monochrome printing).

Text marker examples
Visual effect Markup
 ^  {{colorbox|#CEF2E0|^}}
 †  {{colorbox|#CEDFF2|†}}
 ‡  {{colorbox|#DDCEF2|‡}}
 *  {{colorbox|#F2E0CE|*}}

Note: The HTML code * must be used to create the asterisk as Wikipedia will treat the typed asterisk as an indented bullet point.

Template parameters

ParameterDescriptionDefaultStatus
1backgroundBackground color of the box. Colors are most commonly specified as either a color keyword or as the hexadecimal triplet representing an RGB combination. See web colors for details. Note: Using black, blue, purple, or red colorbox obscures plain text, unvisited, visited, and missing wikilinks, respectively, as these are the default colors for most users. Such dark colors provide bad contrast ratio anyway, so you should use only light colors for accessible content.whitesuggested
2textText displayed in the box. Displayed in default foreground color (usually black).emptyoptional
3linkTarget of the link in the box. If omitted or blank, the text in the box will not be linked.emptyoptional
titletooltipTooltip of the box(value of background parameter)optional
<templatedata>JSON</templatedata> ./. {{TemplateBox}}
TemplateData

TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.


Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either ‎useTemplateData=1 or ‎useTemplateData=only on the ‎/doc subpage and transcluding it with {{Documentation}} into the template. ‎<nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.

Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw ‎<templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.


Wikipedia's help about TemplateDataCommons-specific information

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
background1

Background color of the box. Colors are most commonly specified as either a color keyword or as the hexadecimal triplet representing an RGB combination. Note: Using black, blue, purple, or red colorbox obscures plain text, unvisited, visited, and missing wikilinks, respectively, as these are the default colors for most users. Such dark colors provide bad contrast ratio anyway, so you should use only light colors for accessible content.

Default
white
Linesuggested
text2

Text displayed in the box. Displayed in default foreground color (usually black).

Lineoptional
link3

Target of the link in the box. If omitted or blank, the text in the box will not be linked.

Page nameoptional
tooltiptitle

Tooltip of the box

Default
(value of background parameter)
Lineoptional

Additional information

The template is intended to be used in the following namespaces: no namespace specified

The template is intended to be used by the following user groups: no user group specified

See also

  • Template:Swatch
  • With {{Color}} also the color of the text can be defined (by the 1st parameter) - default like above
    • {{Colorbox|blue|text}} gives the same as
    {{Color|#000|bg=blue|&nbsp; text &nbsp;|css=border:1px solid #AAA}}
    • {{Colorbox|blue|link|w:}} gives the same as
    {{Color||bg=blue|[[w:link]]|&nbsp; text &nbsp;|css=border:1px solid #AAA}}

Localization

This template is not intended to be localized.

Examples

Examples
Visual effect Markup
     {{colorbox|Red}}
 Default color for this text  {{colorbox|Fuchsia|Default color for this text}}
 Wikilink to the article on Wikipedia  {{colorbox|Yellow|Wikilink to the article on Wikipedia|Wikipedia:}}
 Using an X11 color name  {{colorbox|Chartreuse|Using an '''{{W|X11 color names|X11 color name}}'''}}
 same color as "#DC2"  {{colorbox|Rgb(86.7% 80% 13.3%)|same color as "#DC2"}} = dez. 221-204-34
 Using RGB hex triplet  {{colorbox|#FEDCBA|''Using RGB hex triplet''|W:Web colors#Hex triplet}}
 Wikilink to the German Wikipedia  {{colorbox|#CFE|Wikilink to the {{Wd||German Wikipedia}}}}
 Wikilink to the German Wikipedia  {{Color|b|bg=#CFE| Wikilink to the {{Wd||German Wikipedia}} |css=border:1px solid #AAA}}