Template:VColor: Difference between revisions

From Melvor Idle
(Initial creation)
 
m (noinclude -> onlyinclude)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>
<templatedata>
<templatedata>
{
{
"params": {
"params": {
"1": {
"1": {
"label": "Version number",
"label": "Version Number",
                        "description": "Version number to be compared to current game version",
"description": "Version number to be compared to current game version",
"type": "number",
"type": "number",
"required": true
"required": true
Line 25: Line 24:
"type": "string",
"type": "string",
"description": "Text to be displayed instead of the version number"
"description": "Text to be displayed instead of the version number"
},
"Base": {
"label": "Base Version",
"description": "Version to compare \"Version Number\" against if not the current version",
"type": "number"
}
}
},
},
Line 45: Line 49:
| {{T|VColor|0.17|Text=Out of date|ColorOld=#FF0000}}
| {{T|VColor|0.17|Text=Out of date|ColorOld=#FF0000}}
{{VColor|0.17|Text=Out of date|ColorOld=#C00000}}
{{VColor|0.17|Text=Out of date|ColorOld=#C00000}}
|-
| {{T|VColor|0.40|Base=1.00|Text=Always out of date}}
{{VColor|0.40|Base=1.00|Text=Always out of date}}
|}
|}


</noinclude><!--
<!--
Template begins --><noinclude>{| class="wikitable"
Template begins -->{| class="wikitable"
|-
|-
</noinclude><td style="background-color:{{#ifexpr:{{{1|0}}} >= {{CurrentVersion}}|{{{ColorCurrent|#E8FFEB}}}|{{{ColorOld|#FFE8E8}}}}};">{{{Text|{{{1}}}}}}</td><noinclude>
<onlyinclude><includeonly><td style="{{#ifeq:{{{1|0}}}|{{{Base|{{CurrentVersion}}}}}|background-color:{{{ColorCurrent|#E8FFEB}}}|background-color:{{{ColorOld|#FFE8E8}}}}};">{{{Text|{{{1}}}}}}</td></includeonly></onlyinclude>
|}</noinclude>
|}

Latest revision as of 09:30, 31 January 2022

Applies the appropriate background color to a table cell based on whether the given version number is up-to-date in relation to the current game version

Template parameters

ParameterDescriptionTypeStatus
Version Number1

Version number to be compared to current game version

Numberrequired
Color: CurrentColorCurrent

Background color to be displayed when the given version number is current/up to date

Default
#E8FFEB
Stringoptional
Color: OutdatedColorOld

Background color to be displayed when the given version number is outdated

Default
#FFE8E8
Stringoptional
Alternative TextText

Text to be displayed instead of the version number

Stringoptional
Base VersionBase

Version to compare "Version Number" against if not the current version

Numberoptional

Examples

Template Result
{{VColor|1.3.1}} 1.3.1
{{VColor|0.18}} 0.18
{{VColor|0.17|ColorOld=#FF0000|Text=Out of date}} Out of date
{{VColor|0.40|Base=1.00|Text=Always out of date}} Always out of date