Difference between revisions of "Template:Progress bar"
Jump to navigation
Jump to search
(cap overfilled progress bars) |
(a fix for negative values) |
||
Line 1: | Line 1: | ||
− | <includeonly><span><div style="border:1px solid #000; margin:0 0 1px 0"><div style="background:{{{color|#0f0}}}; text-align:right; white-space: nowrap; padding:0em; width:{{#ifexpr: {{{1|0}}} > {{{2|100}}} | 100 |{{formatnum:{{#if:{{#if:{{{1|}}}|{{{1}}}|0}}|{{#expr:100*{{#if:{{{1|}}}|{{{1}}}|0}}/{{{2|{{{total|100}}}}}}round {{{decimal|1}}}}}}}}}}}%"> {{{1}}}/{{{2}}}{{#if:{{{3|}}}| {{{3}}}}} </div></div></span></includeonly><noinclude> | + | <includeonly><span><div style="border:1px solid #000; margin:0 0 1px 0"><div style="background:{{{color|#0f0}}}; text-align:right; white-space: nowrap; padding:0em; width:{{#ifexpr: {{{1|0}}} < 0 |0|{{#ifexpr: {{{1|0}}} > {{{2|100}}} | 100 |{{formatnum:{{#if:{{#if:{{{1|}}}|{{{1}}}|0}}|{{#expr:100*{{#if:{{{1|}}}|{{{1}}}|0}}/{{{2|{{{total|100}}}}}}round {{{decimal|1}}}}}}}}}}}}}%"> {{{1}}}/{{{2}}}{{#if:{{{3|}}}| {{{3}}}}} </div></div></span></includeonly> |
+ | <noinclude> | ||
Template for displaying a progress bar, for use on a gamestate page. | Template for displaying a progress bar, for use on a gamestate page. | ||
Line 12: | Line 13: | ||
{{progress bar|10|7}} | {{progress bar|10|7}} | ||
+ | |||
+ | Negative numbers show as empty: | ||
+ | |||
+ | {{progress bar|-2|7}} | ||
===Specify units=== | ===Specify units=== |
Revision as of 14:52, 20 December 2023
Template for displaying a progress bar, for use on a gamestate page.
Contents
Usage
Regular
{{progress bar|3|7}}
produces:
3/7
Overfilled bars are capped at the maximum:
10/7
Negative numbers show as empty:
-2/7
Specify units
{{progress bar|3|7|players}}
produces:
3/7 players
Colour
{{progress bar|3|7|color=#f90}}
produces:
3/7