Template:Game color: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Unified game color template based on existing feature addition templates (may need something more intuitive))
 
(Had to make this template more complicated to not break if {{{1}}} is empty. Added other colors of this wiki. Added spaces ( ) to be able to preview the color values with their preceding hash sign without creating a nerve-wracking enumeration.)
 
(58 intermediate revisions by 14 users not shown)
Line 1: Line 1:
<includeonly>{{#switch: {{{1}}}
<includeonly>{{#switch:{{{1|}}}
| Source 2006 = <nowiki>#ff8f00</nowiki>
|         = &#32;{{{default|#add8e6}}}
| Source 2007 = <nowiki>#F26025</nowiki>
| todo    = &#32;#8BC53F
| Source 2009 = <nowiki>#558fa5</nowiki>
| in      = &#32;#529352
| Source 2013 = <nowiki>#9bf442</nowiki>
| only    = &#32;#BB8B2D
| Half-Life 2: Episode One = <nowiki>#ff8f00</nowiki>
| also    = &#32;#A5A640
| Half-Life 2: Episode Two = <nowiki>#F26025</nowiki>
| since    = &#32;#458846
| Team Fortress 2 = <nowiki>#CF7336</nowiki>
| removed  = &#32;#B24732
| Portal 2010 ARG Update = <nowiki>#6bbcfa</nowiki>
| not      = &#32;#9D341B
| Left 4 Dead = <nowiki>#317C29</nowiki>
| #default = {{linkless exists|Template:{{{1}}}|{{ {{{1}}}|col}}|&#32;{{{default|#add8e6}}}}}
| Left 4 Dead 2 = <nowiki>#BFA828</nowiki>
}}</includeonly><noinclude><!--
| Left 4 Dead series = <nowiki>#BFA828</nowiki>
| Alien Swarm = <nowiki>#3E6D7F</nowiki>
| Portal 2 = <nowiki>#23B1E5</nowiki>
| Sin Episodes = <nowiki>rgb(100,165,150)</nowiki>
| Black Mesa (Source) = <nowiki>#e47125</nowiki>
| Black Mesa = <nowiki>#e47125</nowiki>
| Garry's Mod = <nowiki>#1295f0</nowiki>
| Insurgency = <nowiki>#c7d1e0</nowiki>
| INFRA = <nowiki>#99ccff</nowiki>
| Contagion = <nowiki>#417ee0</nowiki>
| Counter-Strike: Global Offensive = <nowiki>#5eedaf</nowiki>
| Mapbase = <nowiki>#a163c9</nowiki>
}}</includeonly><noinclude>
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.
:Usage: <code><nowiki><span style="color:{{Game color | </nowiki>''<game name>''<nowiki>}};font-weight:bold;">(I am a specific game or engine branch)</span></nowiki></code>.
:For example: <code><nowiki><span style="color:{{Game color | Counter-Strike: Global Offensive}};font-weight:bold;">(Example text)</span></nowiki></code> → <span style="color:{{Game color | Counter-Strike: Global Offensive}};font-weight:bold;">(I am a specific game or engine branch)</span>
=== Game list ===
{| class="wikitable"
|-
! Game !! Result
|-
| Alien Swarm || style="background:{{Game color|Alien Swarm}};" |
|-
| Black Mesa (Source) || style="background:{{Game color|Black Mesa (Source)}};" |
|-
| Black Mesa || style="background:{{Game color|Black Mesa}};" |
|-
| Contagion || style="background:{{Game color|Contagion}};" |
|-
| Counter-Strike: Global Offensive || style="background:{{Game color|Counter-Strike: Global Offensive}};" |
|-
| Garry's Mod || style="background:{{Game color|Garry's Mod}};" |
|-
| Half-Life 2: Episode One || style="background:{{Game color|Half-Life 2: Episode One}};" |
|-
| Half-Life 2: Episode Two || style="background:{{Game color|Half-Life 2: Episode Two}};" |
|-
| INFRA || style="background:{{Game color|INFRA}};" |
|-
| Insurgency || style="background:{{Game color|Insurgency}};" |
|-
| Left 4 Dead || style="background:{{Game color|Left 4 Dead}};" |
|-
| Left 4 Dead 2 || style="background:{{Game color|Left 4 Dead 2}};" |
|-
| Left 4 Dead series || style="background:{{Game color|Left 4 Dead series}};" |
|-
| Mapbase || style="background:{{Game color|Mapbase}};" |
|-
| Portal 2 || style="background:{{Game color|Portal 2}};" |
|-
| Portal 2010 ARG Update || style="background:{{Game color|Portal 2010 ARG Update}};" |
|-
| Sin Episodes || style="background:{{Game color|Sin Episodes}};" |
|-
| Source 2006 || style="background:{{Game color|Source 2006}};" |
|-
| Source 2007 || style="background:{{Game color|Source 2007}};" |
|-
| Source 2009 || style="background:{{Game color|Source 2009}};" |
|-
| Source 2013 || style="background:{{Game color|Source 2013}};" |
|-
| Team Fortress 2 || style="background:{{Game color|Team Fortress 2}};" |
|-
|}


[[Category:Game icons|G]]
  NOTE: - We're catching the empty string because {{linkless exists|Template:|1|0}} would return 1 and not 0.
        - Viewing #123456 creates an enumeration breaking the paragraph. Viewing &#32;#123456 doesn't have this
          problem (&#32; is a space). Both can be used for style="color: ...".
 
-->{{Deprecated template|notes=Use {{tl2|software}} instead: {{tlc|hl2|col}} &rarr; {{hl2|col}}.}}
{{doc}}
<!-- Add categories to the /doc subpage, not here -->
</noinclude>
</noinclude>

Latest revision as of 10:12, 24 July 2024

Red x.png
This template (and its redirect) is Wikipedia icon Deprecated. Its use is not recommended and its functionality may be compromised.
You can help our editors by replacing or deleting this template on the Pages that use this template. Once no more pages use this template, it should be Marked for deletion.

Additional notes:
Use {{software}} instead: {{hl2|col}} → #E6AC39.
English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

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