Enhance: Cterm colors only loaded when termguicolors = false
This commit is contained in:
parent
67d0989051
commit
82f68c42df
|
@ -5,16 +5,21 @@ local utils_colors = require 'lualine.utils.cterm_colors'
|
|||
local utils = require 'lualine.utils.utils'
|
||||
local section_highlight_map = {x = 'c', y = 'b', z = 'a'}
|
||||
local active_theme = nil
|
||||
local cterm_colors = false
|
||||
|
||||
function M.highlight(name, foreground, background, gui, reload)
|
||||
local command = {'highlight', name}
|
||||
if foreground and foreground ~= 'none' then
|
||||
table.insert(command, 'ctermfg=' .. utils_colors.get_cterm_color(foreground))
|
||||
table.insert(command, 'guifg=' .. foreground)
|
||||
if cterm_colors then
|
||||
table.insert(command, 'ctermfg=' .. utils_colors.get_cterm_color(foreground))
|
||||
end
|
||||
end
|
||||
if background and background ~= 'none' then
|
||||
table.insert(command, 'ctermbg=' .. utils_colors.get_cterm_color(background))
|
||||
table.insert(command, 'guibg=' .. background)
|
||||
if cterm_colors then
|
||||
table.insert(command, 'ctermbg=' .. utils_colors.get_cterm_color(background))
|
||||
end
|
||||
end
|
||||
if gui then
|
||||
table.insert(command, 'cterm=' .. gui)
|
||||
|
@ -29,6 +34,7 @@ end
|
|||
function M.create_highlight_groups(theme)
|
||||
utils.clear_highlights()
|
||||
active_theme = theme
|
||||
cterm_colors = not vim.o.termguicolors
|
||||
for mode, sections in pairs(theme) do
|
||||
for section, colorscheme in pairs(sections) do
|
||||
local highlight_group_name = {'lualine', section, mode}
|
||||
|
|
Loading…
Reference in New Issue