diff --git a/lua/lualine/components/diagnostics/config.lua b/lua/lualine/components/diagnostics/config.lua index f554ed7..6b80fff 100644 --- a/lua/lualine/components/diagnostics/config.lua +++ b/lua/lualine/components/diagnostics/config.lua @@ -20,7 +20,10 @@ M.options = { always_visible = false, sources = { vim.fn.has('nvim-0.6') == 1 and 'nvim_diagnostic' or 'nvim_lsp', 'coc' }, sections = { 'error', 'warn', 'info', 'hint' }, - diagnostics_color = { +} + +function M.apply_default_colors(opts) + local default_diagnostics_color = { error = { fg = utils.extract_color_from_hllist( 'fg', @@ -49,7 +52,8 @@ M.options = { '#273faf' ), }, - }, -} + } + opts.diagnostics_color = vim.tbl_deep_extend('keep', opts.diagnostics_color or {}, default_diagnostics_color) +end return M diff --git a/lua/lualine/components/diagnostics/init.lua b/lua/lualine/components/diagnostics/init.lua index a7e3669..8092ad7 100644 --- a/lua/lualine/components/diagnostics/init.lua +++ b/lua/lualine/components/diagnostics/init.lua @@ -19,6 +19,7 @@ function M:init(options) -- Run super() M.super.init(self, options) -- Apply default options + modules.default_config.apply_default_colors(self.options) self.options = vim.tbl_deep_extend('keep', self.options or {}, modules.default_config.options) -- Apply default symbols self.symbols = vim.tbl_extend( diff --git a/lua/lualine/components/diff/init.lua b/lua/lualine/components/diff/init.lua index a797c8a..5a4fba6 100644 --- a/lua/lualine/components/diff/init.lua +++ b/lua/lualine/components/diff/init.lua @@ -12,7 +12,10 @@ local M = lualine_require.require('lualine.component'):extend() local default_options = { colored = true, symbols = { added = '+', modified = '~', removed = '-' }, - diff_color = { +} + +local function apply_default_colors(opts) + local default_diff_color = { added = { fg = modules.utils.extract_color_from_hllist( 'fg', @@ -34,12 +37,14 @@ local default_options = { '#ff0038' ), }, - }, -} + } + opts.diff_color = vim.tbl_deep_extend('keep', opts.diff_color or {}, default_diff_color) +end -- Initializer function M:init(options) M.super.init(self, options) + apply_default_colors(self.options) self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) -- create highlights and save highlight_name in highlights table if self.options.colored then