Templat:Weather box/colt/sandbox
background:white; color:#000; font-size:85%
The Template:Weather_box/colt makes temperature ("t") background colors. It is an alternative to Template:Weather box/colpastel, which uses lighter shades of color.
Templat:Weather box/temperature
Performance considerations
suntingTemplate:Weather_box/colt has been optimized to handle a range of values which are changed into color codes by using a #switch
function, with 47 branches, ordered by expected frequency. It can assign colors to temperatures in Celsius at over 460 numbers per second, or 9x faster than encoding color settings as 3-part hexadecimal conversions of temperatures. The 47 branches split the overall range into 3-unit brackets, rather than using a precise spectrum of hundreds of shades of color; however, in practice, the 47 possible shades provide enough contrast to emphasize low versus high temperatures.
See also
sunting- Template:Weather box/colpastel - temperature color-style as pastel hues
- Template:Weather box/colp - rain color-style variation as blue tones