Difference between revisions of "Template:ColorMath"
Jump to navigation
Jump to search
m |
m |
||
Line 22: | Line 22: | ||
}} | }} | ||
{{#vardefine:vector|<{{#pad:{{#ifexpr:{{#len:{{#var:x}}}} = 1|.}}|{{{round|3}}}|0|right}}, {{#pad:{{#ifexpr:{{#len:{{#var:y}}}} = 1|.}}|{{{round|3}}}|0|right}}, {{#pad:{{#ifexpr:{{#len:{{#var:z}}}} = 1|.}}|{{{round|3}}}|0|right}}>}} | {{#vardefine:vector|<{{#pad:{{#var:x}}{{#ifexpr:{{#len:{{#var:x}}}} = 1|.}}|{{{round|3}}}|0|right}}, {{#pad:{{#var:y}}{{#ifexpr:{{#len:{{#var:y}}}} = 1|.}}|{{{round|3}}}|0|right}}, {{#pad:{{#var:z}}{{#ifexpr:{{#len:{{#var:z}}}} = 1|.}}|{{{round|3}}}|0|right}}>}} | ||
}}<noinclude> | }}<noinclude> |
Revision as of 13:18, 17 August 2014
Parameters:
- 1 = r [0, 255]
- 2 = g [0, 255]
- 3 = b [0, 255]
- hex = #rrggbb - "#" is optional
Output:
- {{#var:hex}} - html style color integer, without "#"
- {{#var:vector}} - LSL style vector with values [0, 1]
- 001f3f - <{{#pad:0.|3|0|right}}, {{#pad:0.122|3|0|right}}, {{#pad:0.247|3|0|right}}>