Nice. My only comment is that the expression $current.UV will result in a
database lookup for weewx versions prior to v3.7. The expression $trend.UV
will result in two database lookups for all weewx versions. So, I would
suggest storing the results in a variable, then testing against that.

-tk

On Sat, Jul 1, 2017 at 2:06 PM, Radar <[email protected]> wrote:

> if i may this is how i have been doing the colored uv, don't know if it
> will be helpful or not been using this from weewx 2.7 or so
>
> near the top of the tmpl file i have
>
> ## Trend Arrow
> #def Tren_arrow($t)
>  #if $t == None
>   &nbsp;#slurp
>  #else if $t > 0.000
>   &uArr;#slurp
>  #else if $t < 0.00
>   &dArr;#slurp
>  #else
>   &rArr;#slurp
>  #end if
> #end def
>
> ## UV Color
> #def uv_Color($u)
>  #if $u == None or $u <= 0.9
>    >$current.UV ($trend.UV) $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 1 and $u < 2
>   style="background-color: #4eb400"> $current.UV ($trend.UV)
> $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 2 and $u < 3
>   style="background-color: #a0ce00"> $current.UV - (Low) ($trend.UV)
> $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 3 and $u < 4
>   style="background-color: #f7e400"> $current.UV - (Low) ($trend.UV)
> $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 4 and $u < 5
>   style="background-color: #f8b600"><font color="White"> $current.UV -
> (Moderate) ($trend.UV) $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 5 and $u < 6
>   style="background-color: #f88700"><font color="White"> $current.UV -
> (Moderate) ($trend.UV) $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 6 and $u < 7
>   style="background-color: #f85900"><font color="White"> $current.UV -
> (Moderate) ($trend.UV) $Tren_arrow($trend.UV.raw)#slurp
>  #else if $u >= 7 and $u < 8
>   style="background-color: #e82c0e"><font color="White"> $current.UV -
> (High) ($trend.UV) $Tren_arrow($trend.UV.raw)</font>#slurp
>  #else if $u >= 8 and $u < 9
>   style="background-color: #d8001d"><font color="White"> $current.UV -
> (Very High) ($trend.UV) $Tren_arrow($trend.UV.raw)</font>#slurp
>  #else if $u >= 9 and $u < 10
>   style="background-color: #ff0099"><font color="White"> $current.UV -
> (Very High) ($trend.UV) $Tren_arrow($trend.UV.raw)</font>#slurp
>  #else if $u >= 10 and $u < 11
>   style="background-color: #b54cff"><font color="White"> $current.UV -
> (Very High) ($trend.UV) $Tren_arrow($trend.UV.raw)</font>#slurp
>  #else if $u >= 11
>   style="background-color: #998cff"><font color="White"> $current.UV -
> (Extreme) ($trend.UV) $Tren_arrow($trend.UV.raw)</font>#slurp
>  #else
>    >&nbsp;#slurp
>  #end if
> #end def
>
> then to use it i have
> #if $day.UV.has_data
>   <tr>
>     <td class="stats_label">UV</td>
>     <td class="stats_data" $uv_Color($current.UV.raw) </td>
>   </tr>
> #end if
>
>
>
> On Sunday, January 4, 2015 at 1:32:17 AM UTC-6, 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.

Reply via email to