Template:Key/doc: Difference between revisions

From DynamicPageList3 Manual
Content added Content deleted
No edit summary
Line 70: Line 70:


== Change the default colour ==
== Change the default colour ==
The default colour for the keyboard and mouse is suitable for dark-skinned wikis. To change the default settings so it fits for a light-skinned wiki, without having to use ''keyboardvariant = light'' each time you can search for and change these sections in the template:
The default colour for the keyboard and mouse is suitable for dark-skinned wikis. To change the default settings so it fits for a light-skinned wiki, without having to use <code>keyboardvariant = light</code> each time you can search for and change these sections in the template:



Search for: <code>|#default = _White_Mouse_</code><br/>
Search for: <code>|#default = _White_Mouse_</code><br/>
Line 76: Line 77:




Search for: <code><nowiki><kbd class="{{#switch: {{lc:{{{keyboardvariant}}}}} |dark=keysDark|light=keysLight|</nowiki><div style="color: #00ff00;">keysDark}}</div>"></code><br/>
Search for: <code><nowiki><kbd class="{{#switch: {{lc:{{{keyboardvariant}}}}} |dark=keysDark|light=keysLight|</nowiki><div style="color: #00ff00;">keysDark</div>}}"></code><br/>
...and change ''keysDark'' at the end of the line to <code>''keysLight''</code>.
...and change ''keysDark'' at the end of the line to <code>''keysLight''</code>.



Revision as of 15:23, 16 July 2019

Template:Doc/start When used, this template displays game controls, supporting both keyboard keys and controller buttons.

Usage

Keyboard

{{key | keyboard = keyboard key | keyboardvariant = dark or light }}

  • The keyboard parameter is the keyboard key to be pressed.
  • The keyboardvariant parameter is the graphic style and is not required - the template defaults to dark, rendering a white key with black text. Enter dark for dark wikis, or light for light wikis.

Controller

{{key | console = console type | key = controller button | size = optional size }}

  • The console parameter is used to state which console the key belongs to. The parameter is not case-sensitive. See Template:Key/library for possible values.
  • The button parameter is the button to be pressed, such as "A" or "Cross". Note that this template uses the registered trademark names, i.e. "cross" instead of "X" for Playstation buttons, but the template has alternative spellings and entries included. See Template:Key/library for possible values.
  • The size parameter is optional, and sizes the button image. If this parameter is not entered, the default image size is 50px.

Examples

Keyboard

The keyboardvariant parameter does not usually need to be entered explicitly. A default is generally set during a wiki's spinup. The parameter is used here to illustrate the two available versions.

{{#vardefine:console|}}{{#vardefine:key|{{{2}}}}}{{#vardefine:keyboard|caps lock}}Template:!((File:undefined {{#var:key}}.png|alt={{#var:key}}|20px|link=|{{#var:key}}Template:))!{{#var:keyboard}}

{{key
| keyboard = caps lock
| keyboardvariant = dark
}}

Or for light wikis:

{{#vardefine:console|}}{{#vardefine:key|{{{2}}}}}{{#vardefine:keyboard|caps lock}}Template:!((File:undefined {{#var:key}}.png|alt={{#var:key}}|20px|link=|{{#var:key}}Template:))!{{#var:keyboard}}

{{key
| keyboard = caps lock
| keyboardvariant = light
}}

Keyboard keys can be entered in shorthand like this: {{#vardefine:console|}}{{#vardefine:key|{{{2}}}}}{{#vardefine:keyboard|caps lock}}Template:!((File:undefined {{#var:key}}.png|alt={{#var:key}}|20px|link=|{{#var:key}}Template:))!{{#var:keyboard}}

{{key|caps lock}}

Controller


{{#vardefine:console|360}}{{#vardefine:key|A}}{{#vardefine:keyboard|}}Template:!((File:undefined {{#var:key}}.png|alt={{#var:key}}|50px|link=|{{#var:key}}Template:))!{{#var:keyboard}}

{{key
| console = 360
| key = A
| size = 50px
}}

Change the default colour

The default colour for the keyboard and mouse is suitable for dark-skinned wikis. To change the default settings so it fits for a light-skinned wiki, without having to use keyboardvariant = light each time you can search for and change these sections in the template:


Search for: |#default = _White_Mouse_
...and change it to: |#default = _Black_Mouse_


Search for: <kbd class="{{#switch: {{lc:{{{keyboardvariant}}}}} |dark=keysDark|light=keysLight|

keysDark

}}">

...and change keysDark at the end of the line to keysLight.

Template:Doc/end