Proritize color option then theme when creating comppnent_hl

closes #299
This commit is contained in:
shadmansaleh 2021-07-27 13:18:25 +06:00
parent 87b060f390
commit f7c44efb6f
1 changed files with 4 additions and 2 deletions

View File

@ -111,8 +111,10 @@ function M.create_component_highlight_group(color, highlight_tag, options)
local default_color_table = active_theme[mode] and local default_color_table = active_theme[mode] and
active_theme[mode][section] or active_theme[mode][section] or
active_theme.normal[section] active_theme.normal[section]
local bg = (color.bg or default_color_table.bg) local bg = (color.bg or (type(options.color) == 'table' and options.color.bg)
local fg = (color.fg or default_color_table.fg) or default_color_table.bg)
local fg = (color.fg or (type(options.color) == 'table' and options.color.bg)
or default_color_table.fg)
-- Check if it's same as normal mode if it is no need to create aditional highlight -- Check if it's same as normal mode if it is no need to create aditional highlight
if mode ~= 'normal' then if mode ~= 'normal' then
if bg ~= normal_hl.bg or fg ~= normal_hl.fg then if bg ~= normal_hl.bg or fg ~= normal_hl.fg then