Template:Composition bar: Difference between revisions
Appearance
Pepperonipi (talk | contribs) Created page with "<div style="{{#ifeq:{{{width|}}}|auto||width: {{#iferror:{{#expr:{{{width|}}}}}|{{{width}}}|{{{width|100}}}px}};}}"><span class="nowrap">{{formatnum:{{{1|50}}}}} / {{formatnum..." |
Jaspattack (talk | contribs) mNo edit summary |
||
| (3 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
<div style="{{#ifeq:{{{width|}}}|auto||width: {{#iferror:{{#expr:{{{width|}}}}}|{{{width}}}|{{{width|100}}} | <div style="{{#ifeq:{{{width|}}}|auto||width: {{#iferror:{{#expr:{{{width|}}}}}|{{{width}}}|{{{width|100}}}%}};}}"><span class="nowrap">{{formatnum:{{{1|50}}}}} {{#if: {{{text1|}}}|{{{text1|}}} }}/ {{#if: {{{text2|}}}|{{{text2|}}}|{{#ifeq: {{{2|}}}|inf|∞|{{formatnum:{{{2|100}}}}}}}{{#if:{{{per|}}}| ({{#expr:(({{{1|50}}}/{{{2|100}}})*100) round (-1*{{min|0|{{Order of magnitude|{{#expr:({{{1|50}}}/{{{2|100}}})*100}}}}}}) }}%)}}{{{ref|}}}}}</span><div role="img" style="{{#ifeq:{{{border|{{{border-color|}}}}}}|none||box-sizing: border-box; border: 1px solid {{{border|{{{border-color|#aaa}}}}}};}} {{#if:{{{background-color|}}}|background-color: {{{background-color}}};}} height: 1.15em; position: relative;"><div style="background-color: {{#if:{{Both|{{{4|}}}|{{{5|}}}}} | ||
| rgb({{#expr:255*{{{3|255}}}}}, {{#expr:255*{{{4|0}}}}}, {{#expr:255*{{{5|0}}}}}) | | rgb({{#expr:255*{{{3|255}}}}}, {{#expr:255*{{{4|0}}}}}, {{#expr:255*{{{5|0}}}}}) | ||
| {{{hex|{{{3|# | | {{{hex|{{{3|#C0D1E9}}}}}} | ||
}}; width: {{#expr:(({{{1|50}}}/{{{2|100}}})*100) round (-1*{{min|0|{{Order of magnitude|{{#expr:({{{1|50}}}/{{{2|100}}})*100}}}}}}) }}%; height: 100%;"></div></div></div><noinclude> | }}; width: {{#ifeq: {{{2|}}}|inf|100|{{#expr:(({{{1|50}}}/{{{2|100}}})*100) round (-1*{{min|0|{{Order of magnitude|{{#expr:({{{1|50}}}/{{{2|100}}})*100}}}}}}) }}}}%; height: 100%;"></div></div></div><noinclude>{{Documentation}}</noinclude> | ||
{{Documentation}}</noinclude> | |||
Latest revision as of 00:43, 9 September 2020
50 / 100
| Parts of this documentation were copied from the English Wikipedia article on this module. Note that the documentation could have been edited since copying. |
The Composition bar template displays the numeric composition of a thing in terms of its sub-units. It can also be used as a meta template.
Parameters
1- the number of subunits2- the total number of subunits possible3- (default is #C0D1E9) The third parameter is the background color of the left part of the bar - a valid web color, which can be specified by name, as a hex triplet (#rrbbgg), or rgb triplet (rgb(0–255,0–255,0–255)).background-color- (default is transparent) is the background color of the right part of the bar - a valid web color.border- (default is #aaa) is the color of the border, or "none" for no borderwidth- (default is 100px) a width value for the bar, such as "100%" or "8em" (unitless numbers are interpreted as px)per- (default is false), when set to any value (true), adds a percentage to the bar as wellref- (default is blank), may be used to add a reference/citation for the numbers.
Examples
| Code | Result |
|---|---|
{{Composition bar|4|16}}
|
4 / 16
|
{{Composition bar|90|100|#F0F0F0|per=1|background-color=#F00}}
|
90 / 100 (90%)
|