Fixed using 'auto' theme with default colorscheme.

When setting theme to 'auto' and using the default colorscheme, lualine
would report "theme not found, defaulting to gruvbox". Fixed by checking
that we get an actual color back when calling utils.extract_highlight_colors
before attempting to apply a brightness modifier.

* Fix brightness_modifier application.

The brightness_modifer() should only be applied when a normal color was
found.

* Apply brightness modifier when normal color not nil.

Moved application of brightness_modifier outside the if statement that
negates the brightness modifier. The modifier will now be applied when
get_color_brightness returns < 0.5.
This commit is contained in:
J. Bromley 2021-07-29 22:47:07 +06:00 committed by shadmansaleh
parent e544b47895
commit f1dbb2f4a8
1 changed files with 8 additions and 6 deletions

View File

@ -117,12 +117,14 @@ local colors = {
-- Change brightness of colors
-- darken incase of light theme lighten incase of dark theme
if get_color_brightness(utils.extract_highlight_colors('Normal', 'bg')) > 0.5 then
brightness_modifier_parameter = -brightness_modifier_parameter
end
for name, color in pairs(colors) do
colors[name] = brightness_modifier(color, brightness_modifier_parameter)
local normal_color = utils.extract_highlight_colors('Normal', 'bg')
if normal_color ~= nil then
if get_color_brightness(normal_color) > 0.5 then
brightness_modifier_parameter = -brightness_modifier_parameter
end
for name, color in pairs(colors) do
colors[name] = brightness_modifier(color, brightness_modifier_parameter)
end
end
-- basic theme defination