Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow configuration of highlight background color #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 32 additions & 14 deletions lua/tmux-status/config.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---@class TmuxStatusComponentColors
---@field window_active string
---@field window_inactive string
---@field window_inactive_recent string
---@field session string
---@field datetime string
---@field battery string
---@field window_active table
---@field window_inactive table
---@field window_inactive_recent table
---@field session table
---@field datetime table
---@field battery table

---@class TmuxStatusComponentWindow
---@field separator string
Expand Down Expand Up @@ -45,10 +45,10 @@ M.default_options = {
icon_bell = "",
icon_mute = "",
icon_activity = "",
text = "dir"
text = "dir",
},
session = {
icon = ""
icon = "",
},
datetime = {
icon = "󱑍",
Expand All @@ -58,12 +58,30 @@ M.default_options = {
icon = "󰂎",
},
colors = {
window_active = "#e69875",
window_inactive = "#859289",
window_inactive_recent = "#3f5865",
session = "#a7c080",
datetime = "#7a8478",
battery = "#7a8478",
window_active = {
fg = "#e69875",
bg = "#1F2430",
},
window_inactive = {
fg = "#859289",
bg = "#1F2430",
},
window_inactive_recent = {
fg = "#3f5865",
bg = "#1F2430",
},
session = {
fg = "#a7c080",
bg = "#1F2430",
},
datetime = {
fg = "#7a8478",
bg = "#1F2430",
},
battery = {
fg = "#7a8478",
bg = "#1F2430",
},
},
force_show = false,
manage_tmux_status = true,
Expand Down
11 changes: 8 additions & 3 deletions lua/tmux-status/highlights.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ local M = {}

---@param colors TmuxStatusComponentColors
function M.create_hightlights(colors)
for name, value in pairs(colors) do
vim.cmd.highlight('tmux_status_' .. name .. ' guifg=' .. value)
end
vim.api.nvim_create_autocmd({ "ColorScheme" }, {
pattern = "*",
callback = function()
for name, value in pairs(colors) do
vim.cmd.highlight("tmux_status_" .. name .. " guifg=" .. value.fg .. " guibg=" .. value.bg)
end
end,
})
end

---@param name string
Expand Down