Difference between revisions of "Template:Button"

From FlightGear wiki
Jump to: navigation, search
m (Fix variables)
(Style)
Line 1: Line 1:
<noinclude>{{WIP}}</noinclude><span style="border: {{{bw|1}}}px solid {{{bc|black}}}; padding: 1px 3px; background: {{{cc|white}}}; font-family: inherit; color: {{{tc|black}}}; font-size: 0.85em;">{{{1|text}}}</span><noinclude>
+
<noinclude>{{WIP}}</noinclude><span style="border: {{{bw|1}}}px solid {{{bc|black}}}; padding: 1px 3px; background: {{{cc|white}}}; font-family: inherit; color: {{{tc|black}}}; font-size: 0.85em;">{{{1|Text}}}</span><noinclude>
 
{{Informative template|1=
 
{{Informative template|1=
 
__NOTOC__
 
__NOTOC__
Line 7: Line 7:
 
== Usage ==
 
== Usage ==
 
  <nowiki>{{</nowiki>'''button'''<nowiki>|</nowiki>text<nowiki>|</nowiki>''tc=black''<nowiki>|</nowiki>''cc=white''<nowiki>|</nowiki>''bc=black''<nowiki>|</nowiki>''bw=1''<nowiki>}}</nowiki>
 
  <nowiki>{{</nowiki>'''button'''<nowiki>|</nowiki>text<nowiki>|</nowiki>''tc=black''<nowiki>|</nowiki>''cc=white''<nowiki>|</nowiki>''bc=black''<nowiki>|</nowiki>''bw=1''<nowiki>}}</nowiki>
=== Parameters ===
+
 
* <tt>'''text'''</tt>: The button text, the only mandatory parameter
+
The only mandatory parameter is '''text'''.
* <tt>'''''tc='''''</tt>: <u>T</u>ext <u>c</u>olour, defaults to <tt>black</tt>
+
 
* <tt>'''''cc='''''</tt>: Button <u>c</u>ap <u>c</u>olour, defaults to <tt>white</tt>
+
; text: Button text
* <tt>'''''bc='''''</tt>: <u>B</u>order <u>c</u>olour, defaults to <tt>black</tt>
+
 
* <tt>'''''bw='''''</tt>: <u>B</u>order <u>w</u>idth in pixels, defaults to <tt>1</tt>
+
; tc: <u>T</u>ext <u>c</u>olour, defaults to <tt>black</tt>
 +
 
 +
; cc: Button <u>c</u>ap <u>c</u>olour, defaults to <tt>white</tt>
 +
 
 +
; bc: <u>B</u>order <u>c</u>olour, defaults to <tt>black</tt>
 +
 
 +
; bw: <u>B</u>order <u>w</u>idth in pixels, defaults to <tt>1</tt>
  
 
=== Colours ===
 
=== Colours ===

Revision as of 16:54, 6 May 2014

WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.
Text
The following template description is not displayed when the template is inserted in an article.

Goal

This template is used in running text to illustrate button presses and lit indicators. It allows the use of alternate colours and border widths.

Usage

{{button|text|tc=black|cc=white|bc=black|bw=1}}

The only mandatory parameter is text.

text
Button text
tc
Text colour, defaults to black
cc
Button cap colour, defaults to white
bc
Border colour, defaults to black
bw
Border width in pixels, defaults to 1

Colours

The template uses cascading style sheet (CSS) colours, and there are five ways to define the colours:

  1. Through colour keywords (either of aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white or yellow);
  2. as three hexadecimal values #rgb, like #F00 for red,
  3. as six hexadecimal values #rrggbb, like #00FF00 for green,
  4. as three integers 0-255 rgb(r,g,b), like rgb(0,255,255) for yellow
  5. as three percentages rgb(r, g, b), like rgb(100%, 0%, 0%) for red

In other words F = FF = 255 = 100%.

Examples

{{button|HDG}}

HDG


{{button|'''ALT'''|tc=black|cc=#AFA|bc=gray|bw=2}}

ALT

Known issues

  • There seems to be a problem adding parameters to the style attribute, in which case this would have been a futile exercise...


  • In some cases workarounds will be required. One of them is for example text containing a | which would require you to insert {{!}} instead of |, since using a "|" inside a template will break it.
  • This template currently wraps, so that for example ALT HOLD may end up having two half boxes with "Page" at the end of one line and "up" at the beginning of the following line.