Template:Begin colored insert/doc

From OpenStreetMap Wiki
Jump to navigation Jump to search

This is a documentation subpage for Template:Begin colored insert.
It contains usage information, categories and other content or metadata that is not part of the original template.

This template, {{Begin colored insert}}, produces a message box with parameters that control its major aesthetic properties to highlight important information on a page.

Usage

{{Begin colored insert}} must be used with {{End insert}} if the |text =, |content = or positional/unnamed third parameter is not used to specify the box's contents.

For colors, it is recommended to use the Wikimedia Foundation's visual design guidelines.

Used alone: {{Begin colored insert|text=Your text here}}

Used in tandem with {{End insert}}:

{{Begin colored insert}}
Your text here…
{{End insert}}

Many named parameters are available to control various major aesthetic properties; descriptions of their usage can be found in the § TemplateData section below.

Syntax

Unnamed / positional parameters

There are three available positional (a/k/a "unnamed") parameters for the most commonly specified settings, which are (in order):

  1. the box's background color,
  2. the color of its drop shadow, appearing to its right and below it,
  3. the box's enclosed content.

While they provide the most convenient method for using this template, care must be taken when using them in this manner. The successful use of any of these as positional or unnamed parameters is contingent on the presence of any that precede them in the order shown above. For example, it is possible to specify only a custom shadow color, as long as there is another unnamed parameter preceding it in the template invocation, even if that other unnamed parameter is empty. This follows the format: {{Begin colored insert||green}} (note the double vertical bar characters between the template name and the second parameter, which create the empty first parameter). Used like this, you would be free to place the enclosed contents for the box on the same line after the template call (or on the next line below) and conclude the message box with the invocation of the {{End insert}} template.

Similarly, only the box's background color (first unnamed parameter) and its contents (third unnamed parameter) may be specified, without setting the shadow color, so long as the second parameter representing it is present, though empty. This follows the format: {{Begin colored insert|orange||My message}} (here the double vertical bars are placed between the two other unnamed parameter values, creating the empty second parameter). This usage pattern has the virtue of being simple, requiring no named parameters, as well as obviating the requirement to invoke the {{End insert}} template, since the message itself is included with the call to {{Begin colored insert}}.

Lastly, it is possible to use this template with all the default color values and specify only the message within, all without any named parameters. It simply must be called with two empty unnamed parameters followed by a third containing the enclosed content, as in: {{Begin colored insert|||My message}}. This is objectively the easiest way to use this template, however it does place some restrictions on what may be included as part of the message. Notably, the message may not contain any equality symbols (=) or the parser will fail to recognize the message as an unnamed parameter value. If the contents of the box does include such a character, you must either replace it with the HTML named entity = or the third parameter must be named as |text = or one of its aliases, |content = or |3 =.

Examples

Default colors
{{Begin colored insert|text=
Example with default colors
}}
or
{{Begin colored insert}}
Example with default colors
{{End insert}}
Renders as…

Example with default colors

Background colors

Blue
Defines "blue" as the hexadecimal #0053b3 or decimal rgb(0, 83, 179) RGB triplets
{{Begin colored insert|blue|text=
Example with blue background
}}
or
{{Begin colored insert|blue}}
Example with blue background
{{End insert}}
Renders as…

Example with blue background

Green
Defines "green" as the hexadecimal #425e26 or decimal rgb(66, 94, 38) RGB triplets
{{Begin colored insert|green|text=
Example with green background
}}
or
{{Begin colored insert|green}}
Example with green background
{{End insert}}
Renders as…

Example with green background

Yellow
Defines "yellow" as the hexadecimal #fec562 or decimal rgb(254, 197, 98) RGB triplets
{{Begin colored insert|yellow|text=
Example with yellow background
}}
or
{{Begin colored insert|yellow}}
Example with yellow background
{{End insert}}
Renders as…

Example with yellow background

Orange
Defines "orange" as the hexadecimal #fe640b or decimal rgb(254, 100, 11) RGB triplets
{{Begin colored insert|orange|text=
Example with orange background
}}
or
{{Begin colored insert|orange}}
Example with orange background
{{End insert}}
Renders as…

Example with orange background

Greenmedium
Defines "greenmedium" as the hexadecimal #73a441 or decimal rgb(115, 164, 65) RGB triplets
{{Begin colored insert|greenmedium|text=
Example with medium green background
}}
or
{{Begin colored insert|greenmedium}}
Example with medium green background
{{End insert}}
Renders as…

Example with medium green background

Red
Defines "red" as the hexadecimal #b20701 or decimal rgb(178, 7, 1) RGB triplets
{{Begin colored insert|red|text=
Example with red background
}}
or
{{Begin colored insert|red}}
Example with red background
{{End insert}}
Renders as…

Example with red background

Gray / grey
Defines "gray"/"grey" as the hexadecimal #595959 or decimal rgb(89, 89, 89) RGB triplets
{{Begin colored insert|gray|text=
Example with gray background
}}
or
{{Begin colored insert|grey}}
Example with grey background
{{End insert}}
Renders as…

Example with gray background

White
Defines "white" as the hexadecimal #fff or decimal rgb(255, 255, 255) RGB triplets
{{Begin colored insert|white|text=
Example with white background
}}
or
{{Begin colored insert|white}}
Example with white background
{{End insert}}
Renders as…

Example with white background

Black
Defines "black" as the hexadecimal #000 or decimal rgb(0, 0, 0) RGB triplets
{{Begin colored insert|black|text=
Example with black background
}}
or
{{Begin colored insert|black}}
Example with black background
{{End insert}}
Renders as…

Example with black background

Transparent
{{Begin colored insert|transp|text=
Example with transparent background
}}
or
{{Begin colored insert|transp}}
Example with transparent background
{{End insert}}
Renders as…

Example with transparent background

Custom
{{Begin colored insert|#fee7e6|text=
Example with custom background color
}}
or
{{Begin colored insert|#fee7e6}}
Example with custom background color
{{End insert}}
Renders as…

Example with custom background color

Drop shadow colors

With regards to the |color-shadow = (or its alias, |2 =) parameter, the value transp indicating transparency serves to disable the shadow entirely, in contrast to the same value's effect when used with the |background-color = (or its alias, |1 =) parameter.

Blue
Defines "blue" as the hexadecimal #1218c4 or decimal rgb(18, 24, 196) RGB triplets
{{Begin colored insert|gray|blue|
Example with blue drop shadow
}}
or
{{Begin colored insert|gray|blue}}
Example with blue drop shadow
{{End insert}}
Renders as…

Example with blue drop shadow

Green
Defines "green" as the hexadecimal #004201 or decimal rgb(0, 66, 1) RGB triplets
{{Begin colored insert|gray|green|
Example with green drop shadow
}}
or
{{Begin colored insert|gray|green}}
Example with green drop shadow
{{End insert}}
Renders as…

Example with green drop shadow

Yellow
Defines "yellow" as the hexadecimal #fbff05 or decimal rgb(251, 255, 5) RGB triplets
{{Begin colored insert|gray|yellow|
Example with yellow drop shadow
}}
or
{{Begin colored insert|gray|yellow}}
Example with yellow drop shadow
{{End insert}}
Renders as…

Example with yellow drop shadow

Orange
Defines "orange" as the hexadecimal #e65719 or decimal rgb(230, 87, 25) RGB triplets
{{Begin colored insert|gray|orange|
Example with orange drop shadow
}}
or
{{Begin colored insert|gray|orange}}
Example with orange drop shadow
{{End insert}}
Renders as…

Example with orange drop shadow

Greenmedium
Defines "greenmedium" as the hexadecimal #0fd21c or decimal rgb(15, 210, 28) RGB triplets
{{Begin colored insert|gray|greenmedium|
Example with medium green drop shadow
}}
or
{{Begin colored insert|gray|greenmedium}}
Example with medium green drop shadow
{{End insert}}
Renders as…

Example with medium green drop shadow

Red
Defines "red" as the hexadecimal #bf0d0d or decimal rgb(191, 13, 13) RGB triplets
{{Begin colored insert|gray|red|
Example with red drop shadow
}}
or
{{Begin colored insert|gray|red}}
Example with red drop shadow
{{End insert}}
Renders as…

Example with red drop shadow

Gray / grey
Defines "gray"/"grey" as the hexadecimal #636363 or decimal rgb(99, 99, 99) RGB triplets
{{Begin colored insert|gray|gray|
Example with gray drop shadow
}}
or
{{Begin colored insert|gray|grey}}
Example with grey drop shadow
{{End insert}}
Renders as…

Example with gray drop shadow

White
Defines "white" as the hexadecimal #fff or decimal rgb(255, 255, 255) RGB triplets
{{Begin colored insert|gray|white|
Example with white drop shadow
}}
or
{{Begin colored insert|gray|white}}
Example with white drop shadow
{{End insert}}
Renders as…

Example with white drop shadow

Black
Defines "black" as the hexadecimal #000 or decimal rgb(0, 0, 0) RGB triplets
{{Begin colored insert|gray|black|
Example with black drop shadow
}}
or
{{Begin colored insert|gray|black}}
Example with black drop shadow
{{End insert}}
Renders as…

Example with black drop shadow

Custom
{{Begin colored insert|gray|#d10d93|
Example with custom drop shadow color
}}
or
{{Begin colored insert|gray|#d10d93}}
Example with custom drop shadow color
{{End insert}}
Renders as…

Example with custom drop shadow color

TemplateData

This is the TemplateData for this template used by VisualEditor.
TemplateData for Begin colored insert

Template that displays a box element around text and other content, whose coloring can be specified.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Box contentstext content 3

The content to be displayed within the box; when used, the trailing {{End insert}} template is unneeded and should be omitted.

Example
My message to appear within the box…
Contentsuggested
Background colorbackground-color 1

Defines the fill color of the box in which the enclosed content appears, must be a valid CSS color value (named color, #RGB or #RRGGBB hexadecimal, rgb() or rgba() decimals, etc.)

Suggested values
blue green yellow orange greenmedium red gray grey white black transp
Default
#fcfcfc
Example
#fee7e6
Lineoptional
Shadow colorcolor-shadow 2

This argument is used to color the outline of the box, for example: blue, green, yellow, orange, medium green, red, gray, white, black, transp

Suggested values
blue green yellow orange greenmedium red gray grey white black transp
Default
#999
Example
#fee7e6
Lineoptional
Text colortext-color

Defines the font color of enclosed text content, must be a valid CSS color value (e.g. named color, #RGB or #RRGGBB hexadecimal, rgb() or rgba() decimal, etc.)

Default
black
Example
moccasin
Lineoptional
Widthwidth

Defines the width of the box, either as an absolute CSS length value with unit suffix, a relative fraction of the page width represented by a percentage or the special value 'fit-content' making the box only as wide as its contents

Suggested values
fit-content
Default
95%
Example
80%
Lineoptional
Content paddingpadding

Defines the width of the null space left between the outer edges of the content and the surrounding box's border, must be composed of 1–4 valid CSS length values with unit suffix(es)

Example
0.5em 1em
Lineoptional
Compact modecompact

If assigned any non-null value, the box's margins from the surrounding content are reduced

Example
1
Booleanoptional
Full heightfull-height

If assigned any non-null value, the box will full the full height of the window/viewport

Example
1
Booleanoptional
Floatfloat

Allows the page contents to flow around the box, which will be oriented along either of the page margins, intended for use with the 'width' parameter

Suggested values
none left right
Default
none
Example
right
Lineoptional

Origin

This template is a fork of the début encart coloré template found at French Wiktionary.

See also