How to set the bg color for a custom component? #700
Answered
by
fitrh
simonmclean
asked this question in
Q&A
-
I have this function which I'd like to use as a custom component local function lsp_statusline_errors()
local count = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
if (count > 0) then
return count
end
return ''
end And I'm setting it in {
lsp_statusline_errors,
{ color = { bg = 'DiagnosticError' } }
}, But no matter how I try to set the color, nothing seems to work. It always just shows the value returned by |
Beta Was this translation helpful? Give feedback.
Answered by
fitrh
Jun 2, 2022
Replies: 1 comment 3 replies
-
The color option accept the following values
So if you want to define color = { bg = "#ff0000" } If you want to use a specific highlight group, then the value must be a string color = "DiagnosticError" Each component have this structure {
function,
color = {}, -- or string or number
-- ...
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
simonmclean
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The color option accept the following values
{ fg = number|string, bg = number|string, gui = string }
So if you want to define
bg
, you have to provide a hex string or a numberIf you want to use a specific highlight group, then the value must be a string
Each component have this structure