From 734c2ac8383bc6afe45796b416cb7c70a090d569 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 15:07:55 +0200 Subject: feat(now): the condition glyph stands in for the title, large card.standard() without a title draws the icon alone at the big value's size, the glyph-for-title case DESIGN.md already allows. The now card uses it and drops the bottom glyph. Co-Authored-By: Claude Opus 5.5 --- lib/card.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/card.lua') diff --git a/lib/card.lua b/lib/card.lua index 6729b31..34c1c0b 100644 --- a/lib/card.lua +++ b/lib/card.lua @@ -320,7 +320,8 @@ end -- The DESIGN.md card in one call: the title top-left, the big value top-right, -- then label-left / value-right rows, all from one fluid base size S. -- --- spec.icon, spec.title the title run, as M.title draws it +-- spec.icon, spec.title the title run, as M.title draws it; no title draws +-- the icon alone at the big value's size -- spec.big the big value; nil drops it (a band carries the value) -- spec.big_color defaults to colors.body -- spec.big_font defaults to FONT_HEAVY; FONT_MONO for a glyph @@ -335,7 +336,9 @@ function M.standard(cr, inner, colors, spec) local rows = spec.rows or {} local big = spec.big and tostring(spec.big) local big_font = spec.big_font or M.FONT_HEAVY - local head = { { M.title_str(spec.icon, spec.title), M.FONT_MONO, LABEL_F } } + -- No title: the icon stands in for it at the big value's size (DESIGN.md). + local head = { spec.title and { M.title_str(spec.icon, spec.title), M.FONT_MONO, LABEL_F } + or { spec.icon, M.FONT_MONO, BIG_F } } if big then head[2] = { big, big_font, BIG_F } end local groups = { head } for _, r in ipairs(rows) do @@ -343,7 +346,7 @@ function M.standard(cr, inner, colors, spec) { r[2] == nil and '--' or tostring(r[2]), M.FONT_MONO, ROW_F } } end -- Height in units of S: the header line, the gap under it, a step per row. - local head_f = big and BIG_F or LABEL_F * 1.2 + local head_f = (big or not spec.title) and BIG_F or LABEL_F * 1.2 local budget = inner.h * (spec.share or 1) local S = clamp(math.min(budget * 0.94 / (head_f + 0.5 + #rows * 0.66), M.fit_unit(cr, inner.w * 0.96, groups, 100)), 10, 72) @@ -354,8 +357,14 @@ function M.standard(cr, inner, colors, spec) M.rgba(cr, spec.big_color or colors.body) M.text_right(cr, inner.x + inner.w, inner.y + S * BIG_F, big) end - M.font(cr, M.FONT_MONO, label_size, false) - M.title(cr, inner.x, inner.y + label_size, spec.icon, spec.title, colors) + if spec.title then + M.font(cr, M.FONT_MONO, label_size, false) + M.title(cr, inner.x, inner.y + label_size, spec.icon, spec.title, colors) + else + M.font(cr, M.FONT_MONO, S * BIG_F, false) + M.rgba(cr, colors.highlight) + M.text(cr, inner.x, inner.y + S * BIG_F, spec.icon) + end local step = row_size * 2.0 local y = inner.y + S * head_f + row_size * 1.6 -- cgit v1.2.3