Difference between revisions of "Template:Color box/doc"

From EVE University Wiki
Jump to: navigation, search
m (→‎Related templates: Remove templates which no longer use {{Color box}})
m (Rewrite documentation.)
Line 1: Line 1:
<noinclude>{{main|Template:Color box}}</noinclude>
+
; Description
==Syntax==
+
: This template creates a colored text box.
This template creates a colored text box.
 
{{code|<nowiki>{{Color box | color= | border= | text= | width= | content }}</nowiki>}}
 
=== Parameters ===
 
All the parameters are optional.
 
;color
 
:This sets the background color of the text box. You can use either color names (e.g. <code>blue</code>, <code>green</code>), or the [http://www.w3schools.com/cssref/css_colors.asp color's RGB values] as a hexadecimal number (which must be preceded by a hash character, e.g. <code>#222222</code> for light gray, or <code>#990099</code> for purple). If omitted, the background color will be black.
 
;border
 
:This sets the color of the border (color formatting as above). If omitted, the border will be light gray.
 
;text
 
:This sets the color of the text (color formatting as above). If omitted, the text will be white.
 
;width
 
:This sets the width of the text box. It's recommended to set this as a percentage (of the paragraph width), so <code>50%</code> will produce a text box half as wide as the surrounding paragraph. If omitted, the text box will be as wide as the surrounding paragraph (<code>100%</code>).
 
;contents
 
:The contents of the text box. This can be as long or short as necessary, and wiki formatting (such as bold text or links) works just fine.
 
=== Usage notes ===
 
The background color should be darker than the border. Depending on how light the background color is, either white or black text is easier to read. Given that the default skin for the UniWiki has light text on a dark background, a text box with a light background will stand out much more than one with a darker background (but will also make a page look more cluttered, especially if it is used repeatedly).  
 
  
== Related templates ==
+
; Syntax
This template is used in a number of more specific templates, such as {{tl|Example}}.
+
: {{T|Color box|3=border= color|4=width= percentage|5=color= color|6=align= position|7=text= color|8=content}}
 +
: All parameters are optional.
 +
:: '''border''' - Sets the border color of the box. The default is set to a shade of {{Co|#888888|gray}}. Colors can be given either by color name<ref>https://www.w3schools.com/cssref/css_colors.asp [2021-10-23]</ref> (e.g. {{Co|red|red}} or {{Co|green|green}}) or values<ref>https://www.w3schools.com/cssref/css_colors_legal.asp [2021-10-23]</ref> (like {{Co|#0000FF|#FF0000}}).
 +
:: '''width''' - Sets the width of the box.  It's recommended to set this as a percentage (of the paragraph width), so <code>50%</code> will produce a text box half as wide as the surrounding paragraph. If omitted, the text box will be as wide as the surrounding paragraph. When width is set to less than <code>100%</code>, the box will be centered.
 +
:: '''color''' - Sets the background color of the box. The default is set to black. For valid values see border
 +
:: '''align''' - Sets the position of the text within the box. The default is set to left. Values are: left, center, right or justify.
 +
:: '''text''' - Sets the text color of the box. The default is set to {{Co|white|white}}. For valid values see border.
 +
:: '''content''' - The contents of the box.  This can be as long or short as necessary, and wiki formatting (such as bold text or links) works just fine. '''Note:''' If the text you would like to use include an equals sign (=), you need to explicitly declare your text as a numbered parameter (i.e. put 1= before your text), otherwise the template will display nothing.  
  
== Examples ==
+
; Usage notes
 +
: The background color should be darker than the border. Depending on how light the background color is, either white or black text is easier to read. Given that the default skin for the UniWiki has light text on a dark background, a text box with a light background will stand out much more than one with a darker background (but will also make a page look more cluttered, especially if it is used repeatedly).
  
<code><nowiki>{{Color box|A very basic text box}}</nowiki></code>:
+
; Examples
 +
: {{Code|<nowiki>{{Color box|A very basic text box}}</nowiki>: gives ...}}
 
{{Color box|A very basic text box}}
 
{{Color box|A very basic text box}}
  
  
<code><nowiki>{{Color box|color=#144f1d|border=#2f8f2f|A more colorful box!}}</nowiki></code>:
+
: {{code|<nowiki>{{Color box|color= #144f1d|border= #2f8f2f|A more colorful box!}}</nowiki>: gives ...}}
{{Color box|color=#144f1d|border=#2f8f2f|A more colorful box!}}
+
{{Color box|color= #144f1d|border= #2f8f2f|A more colorful box!}}
  
  
<code><nowiki>{{Color box|color=#110033|border=#6600bb|width=50%|A smaller, purple box}}</nowiki></code>:
+
: {{Code|<nowiki>{{Color box|color= #110033|border= #6600bb|width=50%|A smaller, purple box}}</nowiki>: gives ...}}
{{Color box|color=#110033|border=#6600bb|width=50%|A smaller, purple box}}
+
{{Color box|color= #110033|border= #6600bb|width=50%|A smaller, purple box}}
  
  
<code><nowiki>{{Color box|color=#66FFFF|border=#6600FF|text=#000000|A light blue box with dark text}}</nowiki></code>:
+
: {{Code|<nowiki>{{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}}</nowiki>: gives ...}}
{{Color box|color=#66FFFF|border=#6600FF|text=#000000|A light blue box with dark text}}
+
{{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}}
 +
 
 +
 
 +
; References
 +
<References />
  
 
<includeonly>[[Category:Formatting templates]]</includeonly>
 
<includeonly>[[Category:Formatting templates]]</includeonly>
 
<noinclude>[[Category:Template documentation]]</noinclude>
 
<noinclude>[[Category:Template documentation]]</noinclude>

Revision as of 15:08, 6 December 2021

Description
This template creates a colored text box.
Syntax
{{Color box|<border= color>|<width= percentage>|<color= color>|<align= position>|<text= color>|<content>}}
All parameters are optional.
border - Sets the border color of the box. The default is set to a shade of gray. Colors can be given either by color name[1] (e.g. red or green) or values[2] (like #FF0000).
width - Sets the width of the box. It's recommended to set this as a percentage (of the paragraph width), so 50% will produce a text box half as wide as the surrounding paragraph. If omitted, the text box will be as wide as the surrounding paragraph. When width is set to less than 100%, the box will be centered.
color - Sets the background color of the box. The default is set to black. For valid values see border
align - Sets the position of the text within the box. The default is set to left. Values are: left, center, right or justify.
text - Sets the text color of the box. The default is set to white. For valid values see border.
content - The contents of the box. This can be as long or short as necessary, and wiki formatting (such as bold text or links) works just fine. Note: If the text you would like to use include an equals sign (=), you need to explicitly declare your text as a numbered parameter (i.e. put 1= before your text), otherwise the template will display nothing.
Usage notes
The background color should be darker than the border. Depending on how light the background color is, either white or black text is easier to read. Given that the default skin for the UniWiki has light text on a dark background, a text box with a light background will stand out much more than one with a darker background (but will also make a page look more cluttered, especially if it is used repeatedly).
Examples
{{Color box|A very basic text box}}: gives ...
A very basic text box


{{Color box|color= #144f1d|border= #2f8f2f|A more colorful box!}}: gives ...
A more colorful box!


{{Color box|color= #110033|border= #6600bb|width=50%|A smaller, purple box}}: gives ...
A smaller, purple box


{{Color box|color= #66FFFF|border= #6600FF|text= black|A light blue box with dark text}}: gives ...
A light blue box with dark text


References