mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-21 16:39:06 +02:00
fix(lualine): dynamically fetch the color used in lualine (#4788)
## Description The color used in lualine was previously static and did not update dynamically when a new colorscheme was applied. This resulted in inconsistencies between the theme and the lualine colors, as the 'local' color table returned the highlight color defined during initialization. This pull request resolves the issue by ensuring that the lualine colors are always in sync with the current colorscheme. It achieves this by using `LazyVim.ui.fg(HIGHLIGHT)` to dynamically fetch the appropriate highlight colors, making the lualine colors responsive to colorscheme changes. ## Related Issue(s) <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots **Before**  **After**  ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
parent
3ac62a4364
commit
e50b43544f
1 changed files with 7 additions and 5 deletions
|
@ -5,9 +5,9 @@ local M = {}
|
||||||
---@param status fun(): nil|"ok"|"error"|"pending"
|
---@param status fun(): nil|"ok"|"error"|"pending"
|
||||||
function M.status(icon, status)
|
function M.status(icon, status)
|
||||||
local colors = {
|
local colors = {
|
||||||
ok = LazyVim.ui.fg("Special"),
|
ok = "Special",
|
||||||
error = LazyVim.ui.fg("DiagnosticError"),
|
error = "DiagnosticError",
|
||||||
pending = LazyVim.ui.fg("DiagnosticWarn"),
|
pending = "DiagnosticWarn",
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
function()
|
function()
|
||||||
|
@ -17,7 +17,7 @@ function M.status(icon, status)
|
||||||
return status() ~= nil
|
return status() ~= nil
|
||||||
end,
|
end,
|
||||||
color = function()
|
color = function()
|
||||||
return colors[status()] or colors.ok
|
return LazyVim.ui.fg(colors[status()] or colors.ok)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -145,7 +145,9 @@ function M.root_dir(opts)
|
||||||
parent = true,
|
parent = true,
|
||||||
other = true,
|
other = true,
|
||||||
icon = " ",
|
icon = " ",
|
||||||
color = LazyVim.ui.fg("Special"),
|
color = function()
|
||||||
|
return LazyVim.ui.fg("Special")
|
||||||
|
end,
|
||||||
}, opts or {})
|
}, opts or {})
|
||||||
|
|
||||||
local function get()
|
local function get()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue