Template:Color box

来自Terraria Wiki
跳到导航 跳到搜索

此模板使用了 Lua。
此模板使用了用 Lua 编程语言编写的 模块:Color。要了解 Lua 的更多信息,参见 en:Terraria Wiki:Lua
Template-info.svg 文档 以下文档来自Template:Color box/doc。(编辑 | 历史

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)