aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/week.lua
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/week.lua')
-rw-r--r--widgets/week.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/widgets/week.lua b/widgets/week.lua
index 262121f..3cf34d1 100644
--- a/widgets/week.lua
+++ b/widgets/week.lua
@@ -19,8 +19,9 @@ local function draw_days(cr, x, y, w, h, colors, days, S)
local lo, hi = math.huge, -math.huge
for _, d in ipairs(days) do
- if d.min then lo = math.min(lo, d.min) end
- if d.max then hi = math.max(hi, d.max) end
+ if d.min and d.max then
+ lo, hi = math.min(lo, d.min, d.max), math.max(hi, d.min, d.max)
+ end
end
local span = (hi > lo) and (hi - lo) or 1
-- Columns as fractions of the width: day | glyph | min | bar | max.
@@ -33,10 +34,13 @@ local function draw_days(cr, x, y, w, h, colors, days, S)
local by = y + step * (i - 0.5) + size * 0.35 -- baseline, centred in the row
card.font(cr, card.FONT_MONO, size, false)
card.rgba(cr, colors.label)
+ local name = weather.clock(d.t, '%a')
card.text(cr, x, by, i == 1 and 'TODAY'
- or (d.t and os.date('%a', d.t):upper() or '--'))
+ or (name == '--' and name or name:upper()))
card.rgba(cr, colors.highlight)
+ card.font(cr, card.FONT_MONO, size * 1.4, false)
card.text(cr, gx, by, weather.icon(d.code, true))
+ card.font(cr, card.FONT_MONO, size, false)
card.rgba(cr, colors.value)
card.text_right(cr, minx, by, weather.deg(d.min))
card.text_right(cr, x + w, by, weather.deg(d.max))