Actions

Template

Difference between revisions of "ColourPercentBG"

From NEC Retro

 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
|value={{{value|}}}
 
|value={{{value|}}}
 
}}}}{{
 
}}}}{{
#ifexpr:{{#var:colourvalue}} > 0.9|{{
+
#ifexpr:{{#var:colourvalue}} > 0.88888888|{{
  #vardefine:startcolour|{{WikiColour|BG|redmagenta}}}}{{
 
  #vardefine:endcolour|{{WikiColour|BG|red}}}}{{
 
  #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.9)*10}}}}|{{
 
 
 
#ifexpr:{{#var:colourvalue}} > 0.8|{{
 
 
   #vardefine:startcolour|{{WikiColour|BG|magenta}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|magenta}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|redmagenta}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|redmagenta}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.8)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.88888888)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.7|{{
+
#ifexpr:{{#var:colourvalue}} > 0.77777777|{{
 
   #vardefine:startcolour|{{WikiColour|BG|purple}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|purple}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|magenta}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|magenta}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.7)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.77777777)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.6|{{
+
#ifexpr:{{#var:colourvalue}} > 0.66666666|{{
 
   #vardefine:startcolour|{{WikiColour|BG|blue}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|blue}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|purple}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|purple}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.6)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.66666666)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.5|{{
+
#ifexpr:{{#var:colourvalue}} > 0.55555555|{{
 
   #vardefine:startcolour|{{WikiColour|BG|cyan}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|cyan}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|blue}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|blue}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.5)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.55555555)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.4|{{
+
#ifexpr:{{#var:colourvalue}} > 0.44444444|{{
 
   #vardefine:startcolour|{{WikiColour|BG|green}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|green}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|cyan}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|cyan}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.4)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.44444444)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.3|{{
+
#ifexpr:{{#var:colourvalue}} > 0.33333333|{{
 
   #vardefine:startcolour|{{WikiColour|BG|yellowgreen}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|yellowgreen}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|green}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|green}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.3)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.33333333)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.2|{{
+
#ifexpr:{{#var:colourvalue}} > 0.22222222|{{
 
   #vardefine:startcolour|{{WikiColour|BG|yellow}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|yellow}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|yellowgreen}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|yellowgreen}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.2)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.22222222)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.1|{{
+
#ifexpr:{{#var:colourvalue}} > 0.11111111|{{
 
   #vardefine:startcolour|{{WikiColour|BG|orange}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|orange}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|yellow}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|yellow}}}}{{
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.1)*10}}}}|{{
+
   #vardefine:newvalue|{{#expr:({{#var:colourvalue}}-0.11111111)*9}}}}|{{
  
#ifexpr:{{#var:colourvalue}} > 0.0|{{
+
#ifexpr:{{#var:colourvalue}} >= 0.0|{{
 
   #vardefine:startcolour|{{WikiColour|BG|red}}}}{{
 
   #vardefine:startcolour|{{WikiColour|BG|red}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|orange}}}}{{
 
   #vardefine:endcolour|{{WikiColour|BG|orange}}}}{{
   #vardefine:newvalue|{{#expr:{{#var:colourvalue}}*10}}}}|}}
+
   #vardefine:newvalue|{{#expr:{{#var:colourvalue}}*9}}}}|}}
}}}}}}}}}}}}}}}}}}{{
+
}}}}}}}}}}}}}}}}{{
 
#vardefine:rmin|{{Hex2Dec|{{#sub:{{#var:startcolour}}|0|2}}}}}}{{
 
#vardefine:rmin|{{Hex2Dec|{{#sub:{{#var:startcolour}}|0|2}}}}}}{{
 
#vardefine:rmax|{{Hex2Dec|{{#sub:{{#var:endcolour}}|0|2}}}}}}{{
 
#vardefine:rmax|{{Hex2Dec|{{#sub:{{#var:endcolour}}|0|2}}}}}}{{
Line 61: Line 56:
 
#vardefine:bmax|{{Hex2Dec|{{#sub:{{#var:endcolour}}|4|2}}}}}}{{
 
#vardefine:bmax|{{Hex2Dec|{{#sub:{{#var:endcolour}}|4|2}}}}}}{{
  
#vardefine:rvalue|{{Percent
+
#vardefine:rvalue|{{#expr:{{#var:rmin}} + (({{#var:rmax}}-{{#var:rmin}}) * {{#var:newvalue}})}}}}{{
|min={{#var:rmin}}
+
#vardefine:gvalue|{{#expr:{{#var:gmin}} + (({{#var:gmax}}-{{#var:gmin}}) * {{#var:newvalue}})}}}}{{
|max={{#var:rmax}}
+
#vardefine:bvalue|{{#expr:{{#var:bmin}} + (({{#var:bmax}}-{{#var:bmin}}) * {{#var:newvalue}})}}}}rgb({{#expr:{{#var:rvalue}}}}, {{#expr:{{#var:gvalue}}}}, {{#expr:{{#var:bvalue}}}})</includeonly><noinclude>
|value={{#expr:{{#var:rmin}} + (1-(({{#var:rmax}}-{{#var:rmin}}) * {{#var:newvalue}}))}}
+
{|
}}}}{{
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=0}}"|0
#vardefine:gvalue|{{Percent
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=15}}"|10
|min={{#var:gmin}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=25}}"|20
|max={{#var:gmax}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=35}}"|30
|value={{#expr:{{#var:gmin}} + (1-(({{#var:gmax}}-{{#var:gmin}}) * {{#var:newvalue}}))}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=45}}"|40
}}}}{{
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=55}}"|50
#vardefine:bvalue|{{Percent
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=65}}"|60
|min={{#var:bmin}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=75}}"|70
|max={{#var:bmax}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=85}}"|80
|value={{#expr:{{#var:bmin}} + (1-(({{#var:bmax}}-{{#var:bmin}}) * {{#var:newvalue}}))}}
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=95}}"|90
}}}}<!--
+
|style="background-color:{{ColourPercentBG|min=0|max=100|value=100}}"|100
 
+
|}
*{{#var:rmin}} {{#var:rmax}} {{#var:colourvalue}} {{#var:newvalue}} -> RED {{#var:rvalue}}
 
*>>{{#expr:{{#var:rmin}} + (({{#var:rmax}}-{{#var:rmin}}) * {{#var:value}})}}
 
*{{#var:gmin}} {{#var:gmax}} {{#var:colourvalue}} {{#var:newvalue}} -> GREEN {{#var:gvalue}}
 
*>>{{#expr:{{#var:gmin}} + (({{#var:gmax}}-{{#var:gmin}}) * {{#var:value}})}}
 
*{{#var:bmin}} {{#var:bmax}} {{#var:colourvalue}} {{#var:newvalue}} -> BLUE {{#var:bvalue}}
 
*>>{{#expr:{{#var:bmin}} + (({{#var:bmax}}-{{#var:bmin}}) * {{#var:value}})}}
 
  
-->rgb({{#expr:abs({{#var:rvalue}}*255)}}, {{#expr:abs({{#var:gvalue}}*255)}}, {{#expr:abs({{#var:bvalue}}*255)}})</includeonly><noinclude>
 
 
{|
 
{|
|style="background-color:{{ColourPercentBG|min=0|max=100|value=5}}"|5
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=1}}"|128KB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=15}}"|15
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=2}}"|256KB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=25}}"|25
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=3}}"|384KB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=35}}"|35
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=4}}"|640KB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=45}}"|45
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=5}}"|1.6MB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=55}}"|55
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=6}}"|1.8MB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=65}}"|65
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=7}}"|2.0MB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=75}}"|75
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=8}}"|3.6MB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=85}}"|85
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=9}}"|5.6MB
|style="background-color:{{ColourPercentBG|min=0|max=100|value=95}}"|95
+
|style="background-color:{{ColourPercentBG|min=1|max=10|value=10}}"|7.6MB
 
|}
 
|}
  
 
{|
 
{|
|style="background-color:{{ColourPercentBG|min=0|max=10|value=1}}"|128KB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=1}}"|8086
|style="background-color:{{ColourPercentBG|min=0|max=10|value=2}}"|256KB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=2}}"|8086-2
|style="background-color:{{ColourPercentBG|min=0|max=10|value=3}}"|384KB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=3}}"|V30
|style="background-color:{{ColourPercentBG|min=0|max=10|value=4}}"|640KB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=4}}"|286
|style="background-color:{{ColourPercentBG|min=0|max=10|value=5}}"|1.6MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=5}}"|386SX
|style="background-color:{{ColourPercentBG|min=0|max=10|value=6}}"|1.8MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=6}}"|386DX
|style="background-color:{{ColourPercentBG|min=0|max=10|value=7}}"|2.0MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=7}}"|V30HL
|style="background-color:{{ColourPercentBG|min=0|max=10|value=8}}"|3.6MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=8}}"|i486SX
|style="background-color:{{ColourPercentBG|min=0|max=10|value=9}}"|5.6MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=9}}"|i486SX2
|style="background-color:{{ColourPercentBG|min=0|max=10|value=10}}"|7.6MB
+
|style="background-color:{{ColourPercentBG|min=1|max=11|value=10}}"|i486DX2
 +
|style="background-color:{{ColourPercentBG|min=1|max=11|value=11}}"|Pentium
 
|}
 
|}
  
 
{|
 
{|
|style="background-color:{{ColourPercentBG|min=0|max=10|value=1}}"|8086
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=1}}"|1
|style="background-color:{{ColourPercentBG|min=0|max=11|value=2}}"|8086-2
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=2}}"|2
|style="background-color:{{ColourPercentBG|min=0|max=11|value=3}}"|V30
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=3}}"|3
|style="background-color:{{ColourPercentBG|min=0|max=11|value=4}}"|286
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=4}}"|4
|style="background-color:{{ColourPercentBG|min=0|max=11|value=5}}"|386SX
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=5}}"|5
|style="background-color:{{ColourPercentBG|min=0|max=11|value=6}}"|386DX
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=6}}"|6
|style="background-color:{{ColourPercentBG|min=0|max=11|value=7}}"|V30HL
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=7}}"|7
|style="background-color:{{ColourPercentBG|min=0|max=11|value=8}}"|i486SX
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=8}}"|8
|style="background-color:{{ColourPercentBG|min=0|max=11|value=9}}"|i486SX2
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=9}}"|9
|style="background-color:{{ColourPercentBG|min=0|max=11|value=10}}"|i486DX2
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=10}}"|10
|style="background-color:{{ColourPercentBG|min=0|max=11|value=11}}"|Pentium
+
|style="background-color:{{ColourPercentBG|min=1|max=30|value=11}}"|11
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=12}}"|12
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=13}}"|13
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=14}}"|14
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=15}}"|15
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=16}}"|16
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=17}}"|17
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=18}}"|18
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=19}}"|19
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=20}}"|20
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=21}}"|21
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=22}}"|22
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=23}}"|23
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=24}}"|24
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=25}}"|25
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=26}}"|26
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=27}}"|27
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=28}}"|28
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=29}}"|29
 +
|style="background-color:{{ColourPercentBG|min=1|max=30|value=30}}"|30
 
|}
 
|}
  
 +
Pleasing multi-coloured background colours for tables. "Key" colours defined in [[Template:WikiColour]].
 +
<pre>{{ColourPercentBG|min=1|max=30|value=21}}</pre>
 +
{{ColourPercentBG|min=1|max=30|value=21}}
  
*{{ColourPercentBG|min=0|max=100|value=0}}
 
*{{ColourPercentBG|min=0|max=100|value=5}}
 
*{{ColourPercentBG|min=0|max=100|value=10}}
 
*{{ColourPercentBG|min=0|max=100|value=15}}
 
*{{ColourPercentBG|min=0|max=100|value=20}}
 
*{{ColourPercentBG|min=0|max=100|value=25}}
 
*{{ColourPercentBG|min=0|max=100|value=30}}
 
*{{ColourPercentBG|min=0|max=100|value=35}}
 
*{{ColourPercentBG|min=0|max=100|value=40}}
 
*{{ColourPercentBG|min=0|max=100|value=45}}
 
*{{ColourPercentBG|min=0|max=100|value=50}}
 
*{{ColourPercentBG|min=0|max=100|value=55}}
 
*{{ColourPercentBG|min=0|max=100|value=60}}
 
*{{ColourPercentBG|min=0|max=100|value=65}}
 
*{{ColourPercentBG|min=0|max=100|value=70}}
 
*{{ColourPercentBG|min=0|max=100|value=75}}
 
*{{ColourPercentBG|min=0|max=100|value=80}}
 
*{{ColourPercentBG|min=0|max=100|value=85}}
 
*{{ColourPercentBG|min=0|max=100|value=90}}
 
*{{ColourPercentBG|min=0|max=100|value=95}}
 
*{{ColourPercentBG|min=0|max=100|value=100}}
 
*{{#var:startcolour}}
 
*{{#var:endcolour}}
 
  
TODO
 
 
[[Category:Templates]]</noinclude>
 
[[Category:Templates]]</noinclude>

Latest revision as of 14:14, 24 February 2022

0 10 20 30 40 50 60 70 80 90 100
128KB 256KB 384KB 640KB 1.6MB 1.8MB 2.0MB 3.6MB 5.6MB 7.6MB
8086 8086-2 V30 286 386SX 386DX V30HL i486SX i486SX2 i486DX2 Pentium
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Pleasing multi-coloured background colours for tables. "Key" colours defined in Template:WikiColour.

{{ColourPercentBG|min=1|max=30|value=21}}

rgb(193.20689835172, 200.48275760069, 255)