Template talk:Metacritic score color

From Valve Developer Community
Jump to: navigation, search
Icon-message-48px.png
Welcome to Template talk:Metacritic score color!
This is the start of the Metacritic score color discussion page.

To add a new message, click on "Add Topic/Reply" button below, and set the "Subject".
To add a Reply, do the same as above, but leave the "Subject" blank.

An easier way to do this Template

ERR
Empty.png
Max_340:48, 3 May 2023 (UTC+4)
When I was working on the {{Infotable}} template, I implemented the Metacritic Score block into it. It's already fully implemented. All colors are taken from the official site and even a text color change has been implemented, because white text on a yellow background is not very noticeable.

Here's my take on the template. If parameter {{{2}}} is not specified, the template will return the background color, if this parameter is specified as color, then the template will return the text color. Feel free to change it if you need to.

  1.  
  2.  
  3.  
  4.  
  5.  
{{Doc}} <includeonly><onlyinclude>{{#switch:{{{2|}}} | #default = {{#ifeq:{{#expr:{{{1|0}}} >= 75}}|1|&#35;66CC33|{{#ifeq:{{#expr:{{{1|0}}} >= 50}}|1|&#35;FFCC33|&#35;FF0000}}}} | color = {{#ifeq:{{#expr:{{{1|0}}} >= 50}}|1|{{#ifeq:{{#expr:{{{1|0}}} < 75}}|1|black|white}}|white}} }}</onlyinclude></includeonly>
ERR
UserAvatarFrame-Equalizer5118.png
Equalizer6:55, 2 May 2023 (UTC−7)
Cool man, thanks. Gotta love working on something for 30 minutes only to find that an easier, better, and faster way already exists. COOL.