From e3462f4a53abaa787c0365c65ce543c01305afdd Mon Sep 17 00:00:00 2001 From: Lucas Patenaude Date: Fri, 13 Feb 2026 02:43:48 -0700 Subject: [PATCH] Add additional parameters for number badge --- 2-browser-folder-cover.lua | 47 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/2-browser-folder-cover.lua b/2-browser-folder-cover.lua index 2df8964..6ca7832 100755 --- a/2-browser-folder-cover.lua +++ b/2-browser-folder-cover.lua @@ -36,17 +36,25 @@ local logger = require("logger") --========================== [[ Folder Cover Tuning ]] ========================== -- Edge bars (above cover) -local EDGE_THICKNESS = Screen:scaleBySize(4.5) -local EDGE_MARGIN = Size.line.medium -local EDGE_COLOR = Blitbuffer.COLOR_GRAY_4 -local EDGE_WIDTH_RATIO = 0.97 +local EDGE_THICKNESS = Screen:scaleBySize(4.5) -- thickness of the top/bottom edge bars +local EDGE_MARGIN = Size.line.medium -- space between edge bars and other elements +local EDGE_COLOR = Blitbuffer.COLOR_GRAY_4 -- color of the edge bars +local EDGE_WIDTH_RATIO = 0.97 -- width of the edge bars relative to the cover width -- Cover face -local COVER_BORDER_SIZE = Size.border.thin -local COVER_BANNER_ALPHA = 0.6 -local NB_ITEMS_FONT_SIZE = 18 -local NB_ITEMS_MARGIN = Screen:scaleBySize(5) -local DIR_MAX_FONT_SIZE = 20 +local COVER_BORDER_SIZE = Size.border.thin -- thickness of the cover border around the image +local COVER_BANNER_ALPHA = 0.6 -- transparency of the folder name banner overlay +local DIR_MAX_FONT_SIZE = 20 -- maximum font size for the folder name text + +--========================== [[ Number Badge Tuning ]] ========================== + +local NB_ITEMS_FONT_SIZE = 18 -- font size of the number badge text +local NB_ITEMS_MARGIN = Screen:scaleBySize(5) -- inset distance of number badge from right & bottom edges +local NB_BADGE_SIZE = Screen:scaleBySize(18) -- default size of the badge (width and height) +local NB_BADGE_PADDING = Screen:scaleBySize(2) -- padding inside the badge frame +local NB_BADGE_RADIUS = 6 -- corner radius for the badge +local NB_BADGE_BG_COLOR = Blitbuffer.COLOR_WHITE -- background color of the badge +local NB_BADGE_MARGIN = Screen:scaleBySize(5) -- inset from right and bottom edges --=============================================================================== @@ -244,7 +252,7 @@ local function patchCoverBrowser(plugin) folder_name_widget = (settings.name_centered.get() and CenterContainer or TopContainer):new { dimen = dimen, FrameContainer:new { - padding = 0, + padding = 0, -- Makes text container larger than image if expanded bordersize = Folder.face.border_size, AlphaContainer:new { alpha = Folder.face.alpha, directory }, }, @@ -257,24 +265,25 @@ local function patchCoverBrowser(plugin) local nbitems_widget if tonumber(nbitems.text) ~= 0 then -- Inset from edges (right AND bottom) using the same margin value - local inset = Folder.face.nb_items_margin + local inset = NB_BADGE_MARGIN nbitems_widget = BottomContainer:new { - -- shrink bottom anchoring area so the badge sits inset upward by `inset` - dimen = { w = dimen.w, h = dimen.h - inset }, + dimen = { + w = dimen.w, + h = dimen.h + }, RightContainer:new { - -- shrink right anchoring area so the badge sits inset leftward by `inset` dimen = { w = dimen.w - inset, - h = nb_size + inset * 2 + math.ceil(nb_size * 0.125), + h = NB_BADGE_SIZE + inset * 2 + math.ceil(NB_BADGE_SIZE * 0.125), }, FrameContainer:new { - padding = Screen:scaleBySize(2), - radius = 6, - background = Blitbuffer.COLOR_WHITE, - CenterContainer:new { dimen = { w = nb_size, h = nb_size }, nbitems }, + padding = NB_BADGE_PADDING, + radius = NB_BADGE_RADIUS, + background = NB_BADGE_BG_COLOR, + CenterContainer:new { dimen = { w = NB_BADGE_SIZE, h = NB_BADGE_SIZE }, nbitems }, }, },