Difference between revisions of "Template:PercentageBar"

From EVE University Wiki
Jump to: navigation, search
(include documentation template)
m
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<includeonly>{| style="width:100%; font-size:80%; text-align:center;"
 
<includeonly>{| style="width:100%; font-size:80%; text-align:center;"
 
     |-
 
     |-
     {{#ifexpr: {{{1}}} = 0 | | {{!}} style="width:{{{1}}}%; color:{{{3}}}; background:{{{2}}};" {{!}} {{#ifexpr: {{{1}}} < 50 | | {{{1}}}% }} }}
+
     {{#ifexpr: {{{1|0}}} = 0 | | {{!}} style="width:{{#ifexpr: {{{1|0}}} > 100 | 100 | {{{1|0}}} }}%; color:{{{3}}}; background:{{{2}}};" {{!}} {{#ifexpr: {{{1|0}}} < 50 | | {{{1|0}}}% }} }}
     | style="color:{{{2}}}; background:{{{3}}};" | {{#ifexpr: {{{1}}} < 50 | {{#ifexpr: {{{1}}} = 0 | &nbsp; | {{{1}}}% | }} }}
+
     | style="color:{{{2}}}; background:{{{3}}};" | {{#ifexpr: {{{1|0}}} < 50 | {{#ifexpr: {{{1|0}}} = 0 | &nbsp; | {{#ifexpr: {{{1|0}}} > 100 | 100 | {{{1|0}}} }}% | }} }}
|}</includeonly><noinclude>{{documentation}}</noinclude>
+
|}</includeonly><noinclude>
 +
{{documentation}}
 +
</noinclude>

Latest revision as of 12:21, 18 March 2021

Template documentation (for the above template, sometimes hidden or invisible)
Description
This template is a utility function that creates a colored bar depicting a percentage value. It is useful, in particular, for constructing table entries for things like damage or resistance profiles, similar to those found on the in-game fitting window. It is intended to be used inside a table cell, typically within another template.
Do not include a percent sign (%) in the input—it will be added to the output automatically. Any non-zero number will be printed on the larger side of the bar. A zero value will result in a blank bar of the secondary color. Inputs greater than 100 will be displayed as 100%. Non-numerical inputs are invalid.
The primary and secondary colors should ideally be contrasting shades of a similar hue, as they will be used as foreground and background for one another. Colors may be specified using official HTML names ("RebeccaPurple"), or hex values ("#663399" or "#639"). (The mixing function on the W3 Schools HTML Color Names website may be useful in constructing appropriate combinations.)
Dependencies
Syntax
Type {{PercentageBar|<percentage>|<primary color>|<secondary color>}} into a table cell.
Sample output
{| class="wikitable"
|-
| {{PercentageBar|35|Cyan|DarkCyan}}
|-
| {{PercentageBar|50|OrangeRed|#592b1a}}
|-
| {{PercentageBar|60|Silver|DimGrey}}
|-
| {{PercentageBar|0|Orange|#59431a}}
|}
gives...
35%
50%
60%
 
See also
Visit Template:PercentageBar/doc to edit this text! (How does this work?) (Refresh this text - why?)