From 5d8e677edc66b88030798f194b443c98ae5eae65 Mon Sep 17 00:00:00 2001 From: Anton Simonov Date: Mon, 26 Feb 2024 17:40:10 +0300 Subject: [PATCH] separate inner section of status line from outer inner now is independent from current mode - easier to read and set bold style - less distraction from switching modes any combination of colors can be set easily - one for inner section - other for outer section style of inner section can be set using bold and others modifications --- yazi-config/preset/theme.toml | 3 +++ yazi-config/src/theme/theme.rs | 1 + yazi-plugin/preset/components/status.lua | 26 ++++++++++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/yazi-config/preset/theme.toml b/yazi-config/preset/theme.toml index 40fc269c..76702cf9 100644 --- a/yazi-config/preset/theme.toml +++ b/yazi-config/preset/theme.toml @@ -48,8 +48,11 @@ syntect_theme = "" [status] separator_open = "" separator_close = "" +# remove separator_style? probably in use on cand.rs:32 separator_style = { fg = "darkgray", bg = "darkgray" } +inner_section = { fg = "black", bg = "darkgray", bold = true } + # Mode mode_normal = { fg = "black", bg = "lightblue", bold = true } mode_select = { fg = "black", bg = "lightgreen", bold = true } diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index 8534c90f..c58c7972 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -49,6 +49,7 @@ struct Status { pub separator_open: String, pub separator_close: String, pub separator_style: Style, + pub inner_section: Style, // Mode pub mode_normal: Style, diff --git a/yazi-plugin/preset/components/status.lua b/yazi-plugin/preset/components/status.lua index 1e9291e1..8c4fa207 100644 --- a/yazi-plugin/preset/components/status.lua +++ b/yazi-plugin/preset/components/status.lua @@ -31,10 +31,17 @@ function Status:size() return ui.Line {} end - local style = self.style() + -- style of inner section always uses inner_section style + -- independent of current mode + + -- set inner separator and section style + local st_sec = THEME.status.inner_section + -- set color of separator to bg of inner section + local fg_sep = st_sec.bg + return ui.Line { - ui.Span(" " .. ya.readable_size(h:size() or h.cha.length) .. " "):fg(style.bg):bg(THEME.status.separator_style.bg), - ui.Span(THEME.status.separator_close):fg(THEME.status.separator_style.fg), + ui.Span(" " .. ya.readable_size(h:size() or h.cha.length) .. " "):style(st_sec), + ui.Span(THEME.status.separator_close):fg(fg_sep), } end @@ -90,10 +97,17 @@ function Status:percentage() percent = string.format(" %3d%% ", percent) end - local style = self.style() + -- style of inner section always uses inner_section style + -- independent of current mode + + -- set inner separator and section style + local st_sec = THEME.status.inner_section + -- set color of separator to bg of inner section + local fg_sep = st_sec.bg + return ui.Line { - ui.Span(" " .. THEME.status.separator_open):fg(THEME.status.separator_style.fg), - ui.Span(percent):fg(style.bg):bg(THEME.status.separator_style.bg), + ui.Span(" " .. THEME.status.separator_open):fg(fg_sep), + ui.Span(percent):style(st_sec), } end