akinsho / akinsho/bufferline.nvim

[Bug]: Does not respect ctermbg/ctermfg settings

Aperta
#788 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Lua
Stelle
4.4k
Fork
240
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Is there an existing issue for this?

- [X] I have searched the existing issues

### What happened?

The issue is that the documentation says one should set the ctermbg and ctermfg colors with this format.

```text
When `termguicolors` is not enabled, a user is expected to specify colour values
similar to the format above (use `ctermbg` and `ctermfg` instead). A user can
also directly specify [colour
numbers](https://www.ditig.com/256-colors-cheat-sheet).

for example: >lua
highlights = {
fill = {
ctermbg = 7,
ctermfg = 0,
}
}

This will set the background of the highlight group to gray and foreground to
black. Here the colours are system determined, and the user may have changed
the rgb values through customizing the terminal emulator itself. This is
possible for colour numbers 0-15.
```

But that doesn't work.

![image](https://github.com/akinsho/bufferline.nvim/assets/16250196/3d9fb334-eacc-4620-b4d7-deebfac80eb0)

As you can see the selected tab text is not in white as specified by `tab_selected.ctermfg = 15`, none of the other colors work either.

### What did you expect to happen?

Use of the specified foreground and background colors instead of the default terminal color, which I have set to green.

### Config

```lua
local bufferline = require("bufferline")

-- background color definitions
-- same as normal background
local background = '#121212'
local backgroundterm = 233
-- not selected, not visible
local normal = '#262626'
local normalterm = 235
-- visible, not selected
local visible = '#444444'
local visibleterm = 238
-- selected
local selected = '#808080'
local selectedterm = 8

-- foreground colors from Coc for hint, info, warning and error
local hintcolor = '#008080'
local hintcolorterm = 6
local infocolor = '#0000FF'
local infocolorterm = 12
local warningcolor = '#FFFF00'
local warningcolorterm = 11
local errorcolor = '#FF0000'
local errorcolorterm = 9

-- :help bufferline-configuration
bufferline.setup(
{
options = {
mode = "buffers",
separator_style = "slant",
--[[
style_preset = {
bufferline.style_preset.no_italic,
bufferline.style_preset.no_bold
},
]]--
numbers = function(opts)
return string.format('%s|%s', opts.raise(opts.ordinal), opts.raise(opts.id))
end,
indicator = {
style = "underline"
},
diagnostics = "coc",
-- ignore unused parameter
-- luacheck: push ignore 212
---@diagnostic disable-next-line
diagnostics_indicator = function(count, level, diagnostics_dict, context)
-- luacheck: pop
if (count == 0) then
return ""
end
--[[
if context.buffer:current() then
return ""
end
]]--
local icon = '' .. ' ' .. level
if level:match("error") then
icon = ''
elseif level:match("warning") then
icon = ''
elseif level:match("info") or level:match("hint") then
icon = ''
end
-- kitty scales down the icon if there is no space on the right
return icon .. " " .. count
end,
hover= {
enabled = true,
delay = 0,
reveal = {"close"}
},
close_icon = '',
buffer_close_icon = '',
show_tab_indicators = true,
show_duplicate_prefix = true,
always_show_bufferline = true,
name_formatter = function(buf)
if (buf.buffers == nil) then
-- it's a buffer
return buf.name
end
-- it's a tab
local count = 0
for _ in pairs(buf.buffers) do count = count + 1 end
return string.format('%d %d ', vim.api.nvim_tabpage_get_number(buf.tabnr), count)
end,
offsets = {
{
filetype = "NvimTree",
text = function()
return vim.fn.getcwd()
end,
highlight = "Directory",
text_align = "left"
}
},
themable = true,
}, -- end options
highlights = { -- help bufferline-highlights
fill = {
bg = background,
ctermbg = backgroundterm
},
tab = { -- non selected tab
bg = normal,
ctermbg = normalterm,
fg = '#808080',
ctermfg = 8
},
tab_separator = { -- non selected tab separators
bg = normal, -- this is inside the "tab"
ctermbg = normalterm,
fg = background, -- actual corner piece, blends into background
ctermfg = backgroundterm
},
tab_selected = { -- selected tab
bg = selected,
ctermbg = selectedterm,
fg = '#FFFFFF',
ctermfg = 15
},
tab_separator_selected = { -- selected tab separators
bg = selected,
ctermbg = selectedterm,
fg = background,
ctermfg = backgroundterm
},
background = { -- non visible, non selected buffers
bg =normal,
ctermbg = normalterm
},
separator = {
bg = normal,
ctermbg = normalterm,
fg = background,
ctermfg = backgroundterm
},
buffer_visible = { -- buffer visible, but not selected
bg = visible,
ctermbg = visibleterm
},
separator_visible = {
bg = visible,
ctermbg = visibleterm,
fg = background,
ctermfg = backgroundterm
},
buffer_selected = {
bg = selected,
ctermbg = selectedterm
},
separator_selected = {
bg = selected,
ctermbg = selectedterm,
fg = background,
ctermfg = backgroundterm
},
modified = {
bg = normal,
ctermfg = normalterm
},
modified_visible = {
bg = visible,
ctermbg = visibleterm
},
modified_selected = {
bg = selected,
ctermbg = selectedterm
},
duplicate = {
strikethrough = true
},
duplicate_visible =
{
strikethrough = true
},
duplicate_selected = {
strikethrough = true
},
diagnostic = {
bg = normal,
ctermbg = normalterm
},
diagnostic_visible = {
bg = visible,
ctermbg = visibleterm
},
diagnostic_selected = {
bg = selected,
ctermbg = selectedterm
},
close_button = {
bg = normal,
ctermbg = normalterm
},
close_button_visible = {
bg = visible,
ctermbg = visibleterm
},
close_button_selected = {
bg = selected,
ctermbg = selectedterm
},
numbers = {
bg = normal,
ctermbg = normalterm
},
numbers_visible = {
bg = visible,
ctermbg = visibleterm
},
numbers_selected = {
bg = selected,
ctermbg = selectedterm
},
hint = {
bg = normal,
ctermbg = normalterm,
sp = hintcolor,
undercurl = true
},
hint_visible = {
bg = visible,
ctermbg = visibleterm,
sp = hintcolor,
undercurl = true
},
hint_selected = {
bg = selected,
ctermbg = selectedterm,
sp = hintcolor,
undercurl = true
},
hint_diagnostic = {
bg = normal,
ctermbg = normalterm,
fg = hintcolor,
ctermfg = hintcolorterm
},
hint_diagnostic_visible = {
bg = visible,
ctermbg = visibleterm,
fg = hintcolor,
ctermfg = hintcolorterm
},
hint_diagnostic_selected = {
bg = selected,
ctermbg = selectedterm,
fg = hintcolor,
ctermfg = hintcolorterm
},
info = {
bg = normal,
ctermbg = normalterm,
sp = infocolor,
undercurl = true
},
info_visible = {
bg = visible,
ctermbg = visibleterm,
sp = infocolor,
undercurl = true
},
info_selected = {
bg = selected,
ctermbg = selectedterm,
sp = infocolor,
undercurl = true
},
info_diagnostic = {
bg = normal,
ctermbg = normalterm,
fg = infocolor,
ctermfg = infocolorterm
},
info_diagnostic_visible = {
bg = visible,
ctermbg = visibleterm,
fg = infocolor,
ctermfg = infocolorterm
},
info_diagnostic_selected = {
bg = selected,
ctermbg = selectedterm,
fg = infocolor,
ctermfg = infocolorterm
},
warning = {
bg = normal,
ctermbg = normalterm,
sp = warningcolor,
undercurl = true
},
warning_visible = {
bg = visible,
ctermbg = visibleterm,
sp = warningcolor,
undercurl = true
},
warning_selected = {
bg = selected,
ctermbg = selectedterm,
sp = warningcolor,
undercurl = true
},
warning_diagnostic = {
bg = normal,
ctermbg = normalterm,
fg = warningcolor,
ctermfg = warningcolorterm
},
warning_diagnostic_visible = {
bg = visible,
ctermbg = visibleterm,
fg = warningcolor,
ctermfg = warningcolorterm
},
warning_diagnostic_selected = {
bg = selected,
ctermbg = selectedterm,
fg = warningcolor,
ctermfg = warningcolorterm
},
error = {
bg = normal,
ctermbg = normalterm,
sp = errorcolor,
undercurl = true
},
error_visible = {
bg = visible,
ctermbg = visibleterm,
sp = errorcolor,
undercurl = true
},
error_selected = {
bg = selected,
ctermbg = selectedterm,
sp = errorcolor,
undercurl = true
},
error_diagnostic = {
bg = normal,
ctermbg = normalterm,
fg = errorcolor,
ctermfg = errorcolorterm
},
error_diagnostic_visible = {
bg = visible,
ctermbg = visibleterm,
fg = errorcolor,
ctermfg = errorcolorterm
},
error_diagnostic_selected = {
bg = selected,
ctermbg = selectedterm,
fg = errorcolor,
ctermfg = errorcolorterm
},
}
})
```

### Additional Information

Terminal is `kitty 0.28.1 created by Kovid Goyal`
nvim is `NVIM v0.10.0-dev-5ceb2238d - Release - LuaJIT 2.1.0-beta3`
OS is `Linux 5.15.0-75-generic #82-Ubuntu SMP Tue Jun 6 23:10:23 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux`
Release is `Ubuntu 22.04 LTS`

Not sure if it ever worked, but I only checked the most recent version, see below.

### commit

bf2f6b7edd0abf6b0732f5e5c0a8f30e51611c75

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.