Template:Color box

From Terraria Wiki
Jump to navigation Jump to search

This template uses Lua.
This template uses Module:Color, a script written in the Lua programming language. To learn more about Lua, see Terraria Wiki:Lua.
Template-info.svg Documentation The documentation below is transcluded from Template:Color box/doc. (edit | history)

Produces a simple colored box.

Usage

{{ color box | <color> | border = <color> | width = <box width> | height = <box height> | size = <box size> | text = y/yes | textformat = hex/rgb}}

First unnamed parameter

Sets the background color of the box. Can be any valid CSS color.

border (optional)

Sets the color of the border around the box. Defaults to text color.

size/width/height (optional)

Size will override the width/height parameter. Width and height default to 1.25em.

text (optional)

Appends the color value from the first unnamed parameter.

textformat (optional)

Forces a specific format of the color text: hexadecimal or RGB. Has no effect if $text is not true. The color value from the first unnamed parameter must be a valid hexadecimal or RGB value (and will be converted according to this parameter, if necessary), otherwise no text will be displayed at all. For instance, orange as the first unnamed parameter will not work with this parameter.

Examples

Code Output
{{color box|#FF00FF}}
{{color box|orange}}
{{color box|orange|text=y}}  orange
{{color box|#FF0000|width=40px}}
{{color box|#FF0000|height=40px}}
{{color box|#FF0000|size=40px}}
{{color box|#FF0000|size=40px|width=1000px}}
{{color box|#FF0000|size=40px|text=y}}  #FF0000
{{color box|rgb(9, 61, 191)|text=y}}  rgb(9, 61, 191)
{{color box|rgb(9, 61, 191)|text=y|textformat=hex}}  #093DBF
{{color box|#093DBF|text=y|textformat=rgb}}  rgb(9, 61, 191)
{{color box|RgB( 9, 61   ,191)|text=y|textformat=rgb}}  rgb(9, 61, 191)