Template:Game color/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎top: clean up, replaced: {{Documentation subpage → {{Doc/subpage)
(Updated doc.)
 
Line 3: Line 3:
__NOTOC__
__NOTOC__
==Usage==
==Usage==
Template for accessing unique, pre-defined colors for games and engine branches documented on the Valve Developer Community, based on feature addition templates. This template forwards a color variable directly and is intended to be used inside of wiki formatting.
'''Game color''' is a template for accessing unique, predefined colors for games and engine branches documented on the Valve Developer Community, based on feature addition templates. This template returns a hexadecimal color value directly and is intended to be used inside of wiki formatting.
{{tip|Every game icon template (such as {{tl2|hl2}}, see [[:Category: Game icons]]) can also return its game color using {{tlc|hl2|col}} → {{hl2|col}}. That approach is much cleaner because {{tl2|game color}} uses a huge switch statement that also uses templates as keys (such as "{{tlc|hl2}}"); This means that every page using {{tl2|game color}} creates an entry in the "What links here" list for all game icon templates used.}}
{{tip|Every game icon template (such as {{tl2|hl2}}, see [[:Category: Game icons]]) can return its game color using {{tlc|hl2|col}} → {{hl2|col}}. This approach is what this template uses. Use that directly wherever possible.}}
 
===Parameters===
* {{param|1}} &ndash; The full name or abbreviation of a game. If <code>Template:''name''</code> exists, {{tlc|game color|''name''}} returns {{tlc|''name''|col}}, otherwise <tt>{{param|default|#add8e6}}</tt>. Other legal values are: <tt>todo, in, only, also, since, removed, not</tt>.
* {{param|default|#add8e6}} &ndash; The fallback return value if {{param|1}} is invalid.


===Examples===
===Examples===
{| class=wikitable
{| style="background:transparent"
|       {{tlc|Game color|csgo}}
| {{tlc|Game color}}
| → || {{Game color|csgo}}
| → || {{Game color}}
| → || <b style="color:{{Game color}}">Example text</b>
|-
|  {{tlc|Game color|hl2}}
| → || {{Game color|hl2}}
| → || <b style="color:{{Game color|hl2}}">Example text</b>
|-
|  {{tlc|Game color|hl2|default{{=}}#00ff88}}
| → || {{Game color|hl2|default=#00ff88}}
| → || <b style="color:{{Game color|hl2|default=#00ff88}}">Example text</b>
|-
|  {{tlc|Game color|qwerty|default{{=}}#00ff88}}
| → || {{Game color|qwerty|default=#00ff88}}
| → || <b style="color:{{Game color|qwerty|default=#00ff88}}">Example text</b>
|-
|  {{tlc|Game color|qwerty}}
| → || {{Game color|qwerty}}
| → || <b style="color:{{Game color|qwerty}}">Example text</b>
|-
|-
| <code><nowiki><span style="color:{{Game color|csgo}}">Example text</span></nowiki></code>
| {{tlc|Game color|todo}}
| → ||     <span style="color:{{Game color|csgo}}">Example text</span>
| → || {{Game color|todo}}
| → || <b style="color:{{Game color|todo}}">Example text</b>
|-
|-
|
| {{tlc|Game color|removed}}
<code style=padding:0>{&#124; class="wikitable"<br>
| → || {{Game color|removed}}
&#124; style="background:&#123;{Game color|as}};"&#124; Example text<br>
| → || <b style="color:{{Game color|removed}}">Example text</b>
&#124;}</code>
| →
|
  {| class="wikitable"
  | style="background:{{Game color|as}};"| Example text
  |}
|}
|}


== See also ==
== See also ==
* {{tl2|new icon}}
* {{tl2|software}}
* {{tl2|game name}}
* {{tl2|in}}
* {{tl2|in}}
* {{tl2|also}}
* {{tl2|also}}

Latest revision as of 10:10, 24 July 2024

Edit-copy.png
This is a documentation subpage for Template:Game color.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

Usage

Game color is a template for accessing unique, predefined colors for games and engine branches documented on the Valve Developer Community, based on feature addition templates. This template returns a hexadecimal color value directly and is intended to be used inside of wiki formatting.

Tip.pngTip:Every game icon template (such as {{hl2}}, see Category: Game icons) can return its game color using {{hl2|col}} → #E6AC39. This approach is what this template uses. Use that directly wherever possible.

Parameters

  • {{{1}}} – The full name or abbreviation of a game. If Template:name exists, {{game color|name}} returns {{name|col}}, otherwise {{{default|#add8e6}}}. Other legal values are: todo, in, only, also, since, removed, not.
  • {{{default|#add8e6}}} – The fallback return value if {{{1}}} is invalid.

Examples

{{Game color}} #add8e6 Example text
{{Game color|hl2}} #E6AC39 Example text
{{Game color|hl2|default=#00ff88}} #E6AC39 Example text
{{Game color|qwerty|default=#00ff88}} #00ff88 Example text
{{Game color|qwerty}} #add8e6 Example text
{{Game color|todo}} #8BC53F Example text
{{Game color|removed}} #B24732 Example text

See also