There's an example in the Wiki
<https://github.com/weewx/weewx/wiki/Colored%20UV%20index> of how to do
this, but I don't think it's particularly efficient.
A search list extension would probably be the most elegant. Then you could
do something like:
<tr>
<td class="stats_label">UV</td>
<td class="stats_data" style="background-color:
$UV_color($current.UV.raw)">$current.UV $UV_text($current.UV.raw)</td>
</tr>
The functions $UV_color() and $UV_text() would return an appropriate color
and warning, respectively, depending on their argument. An elegant touch
would be for $UV_text() to get its strings out of skin.conf, making it easy
to internationalize the text.
-tk
On Sun, Jun 25, 2017 at 3:06 AM, Neil Trimboy <[email protected]>
wrote:
> Just wondering if embedding these colour mappings inside templates is the
> correct way to solve the problem.?
>
> There are several instances when this may be wanted : UV, Heat Index,
> HumidyIndex and others all of which have, I believe, standardised colours
> for defined ranges AND standardised textual descriptions (ie Danger - see
> http://www.nws.noaa.gov/om/heat/heat_index.shtml)
>
> I would suspect the elegant way to solve this might be to extend something
> in units.py ?
>
> Any thoughts or pointers from any experts for me to dabble with
> appreciated. Thanks
>
>
> On Sunday, 4 January 2015 20:32:17 UTC+13, Liz wrote:
>>
>> I've been playing with this on the standard skin, and have left further
>> comments on the wiki
>> https://sourceforge.net/p/weewx/wiki/Colored%20UV%20index/
>>
>> I had some problems with the wiki formatting, which just wouldn't let
>> me put in an example of code to change the font colour. I thought that
>> red font on red background wasn't going to be useful, and switched all
>> of mine to black font.
>>
>> Liz
>>
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.