diff options
Diffstat (limited to 'widgets/hourly.lua')
| -rw-r--r-- | widgets/hourly.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/widgets/hourly.lua b/widgets/hourly.lua index 82f7585..dfcc64d 100644 --- a/widgets/hourly.lua +++ b/widgets/hourly.lua @@ -13,7 +13,7 @@ local M = {} -- Every third hour is labelled; all 24 shape the curve. local function draw_curve(cr, x, y, w, h, colors, hours, S) local n = math.min(#hours, 24) - local label = math.max(9, math.min(h * 0.11, w / 8 * 0.22)) + local label = math.max(9, math.min(h * 0.135, w / 8 * 0.22, S * 0.32)) local glyph = label * 1.5 local slot = w / n local function px(i) return x + (i - 0.5) * slot end @@ -31,12 +31,15 @@ local function draw_curve(cr, x, y, w, h, colors, hours, S) local span = math.max(hi - lo, 1) local function py(t) return base - (base - top) * (0.15 + 0.7 * (t - lo) / span) end - -- Rain chance as bars rising from the baseline, under the curve. - card.rgba(cr, colors.value, 0.3) + -- Rain chance as bars rising from the baseline, under the curve. Typical + -- chances are a few percent, which scaled honestly is a 1px bar no alpha can + -- rescue, so any nonzero chance gets a floor; the half alpha keeps the bars + -- a backdrop to the full-strength curve. + card.rgba(cr, colors.value, 0.5) for i = 1, n do local p = math.min(hours[i].precip or 0, 100) if p > 0 then - local bh = (base - top) * 0.5 * p / 100 + local bh = math.max((base - top) * 0.5 * p / 100, label * 0.4) cairo_rectangle(cr, px(i) - slot * 0.3, base - bh, slot * 0.6, bh) end end @@ -88,7 +91,7 @@ function M.draw(cr, rect, colors) -- hours[1] is the current hour, so the big value is the one after it. local y, S = card.standard(cr, inner, colors, { icon = card.ICON.hourly, title = 'NEXT 24H', - big = weather.deg((w.hours[2] or {}).temp), share = 0.4, + big = weather.deg((w.hours[2] or {}).temp), share = 0.56, }) draw_curve(cr, inner.x, y, inner.w, inner.y + inner.h - y, colors, w.hours, S) end |
