This commit is contained in:
2026-01-14 12:15:03 +01:00
parent 87eec4a51e
commit 81d55e4646
+6 -1
View File
@@ -387,7 +387,7 @@ data:
color_yellow: "#F0F046" color_yellow: "#F0F046"
color_blue: "#46F0F0" color_blue: "#46F0F0"
color_white: "#FFFFFF" color_white: "#FFFFFF"
overlay_color: "rgba(255,0,255,0.35)" overlay_color: "rgba(0,0,0,0.35)"
template: | template: |
{{/* Weather widget fully customizable via options */}} {{/* Weather widget fully customizable via options */}}
{{ $temp_unit := .Options.StringOr "temp_unit" "celsius" }} {{ $temp_unit := .Options.StringOr "temp_unit" "celsius" }}
@@ -534,6 +534,11 @@ data:
{{ $thisHighPct := sub 1 (div (sub $max_max $thisHigh) $temp_range) }} {{ $thisHighPct := sub 1 (div (sub $max_max $thisHigh) $temp_range) }}
{{ $thisLowPct := div (sub $thisLow $min_min) $temp_range }} {{ $thisLowPct := div (sub $thisLow $min_min) $temp_range }}
{{ $thisTempRange := sub $thisHigh $thisLow }} {{ $thisTempRange := sub $thisHigh $thisLow }}
{{ $red_pos := mul 100 (div (sub $thisHigh $temp_red) $thisTempRange) | toInt }}
{{ $yel_pos := mul 100 (div (sub $thisHigh $temp_yellow) $thisTempRange) | toInt }}
{{ $blu_pos := mul 100 (div (sub $thisHigh $temp_blue) $thisTempRange) | toInt }}
{{ $whi_pos := mul 100 (div (sub $thisHigh $temp_white) $thisTempRange) | toInt }}
{{ $gradient_string := printf "%s %d%%, %s %d%%, %s %d%%, %s %d%%" $color_red $red_pos $color_yellow $yel_pos $color_blue $blu_pos $color_white $whi_pos }}
{{/* Clamp helper (no clamp() function in Glance templates) */}} {{/* Clamp helper (no clamp() function in Glance templates) */}}
{{ $pRed := $red_pos }}{{ if lt $pRed 0 }}{{ $pRed = 0 }}{{ end }}{{ if gt $pRed 100 }}{{ $pRed = 100 }}{{ end }} {{ $pRed := $red_pos }}{{ if lt $pRed 0 }}{{ $pRed = 0 }}{{ end }}{{ if gt $pRed 100 }}{{ $pRed = 100 }}{{ end }}
{{ $pYel := $yel_pos }}{{ if lt $pYel 0 }}{{ $pYel = 0 }}{{ end }}{{ if gt $pYel 100 }}{{ $pYel = 100 }}{{ end }} {{ $pYel := $yel_pos }}{{ if lt $pYel 0 }}{{ $pYel = 0 }}{{ end }}{{ if gt $pYel 100 }}{{ $pYel = 100 }}{{ end }}