feat: allow x,y,z sections to be themed independently (#238)
If theme for x,y,z is unspecified the defaukt to c,b,a respectively
This commit is contained in:
parent
1ee99e0473
commit
634959f0e9
|
@ -24,8 +24,11 @@ lualine theme at lua/lualine/themes/{your_colorscheme}.lua in you repo.
|
||||||
To create a custom theme you need to define a colorscheme for each of vim's modes. Each mode has a `fg` and `bg` field for every lualine section.
|
To create a custom theme you need to define a colorscheme for each of vim's modes. Each mode has a `fg` and `bg` field for every lualine section.
|
||||||
You can add special effects with `gui`.
|
You can add special effects with `gui`.
|
||||||
|
|
||||||
Adding theme is really easy in lua. Here is and example of a gruvbox theme.
|
Though the example shows a,b,c being set you can specify theme for x, y, z too.
|
||||||
|
But if unspecified then they default to c, b, a sections theme respectively .
|
||||||
|
Also all modes theme defaults to normal modes theme.
|
||||||
|
|
||||||
|
Adding theme is really easy in lua. Here is and example of a gruvbox theme.
|
||||||
```lua
|
```lua
|
||||||
local gruvbox = { }
|
local gruvbox = { }
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,8 @@ function M.create_component_highlight_group(color, highlight_tag, options)
|
||||||
local normal_hl
|
local normal_hl
|
||||||
-- convert lualine_a -> a before setting section
|
-- convert lualine_a -> a before setting section
|
||||||
local section = options.self.section:match('lualine_(.*)')
|
local section = options.self.section:match('lualine_(.*)')
|
||||||
if section > 'c' then section = section_highlight_map[section] end
|
if section > 'c' and not active_theme.normal[section] then
|
||||||
|
section = section_highlight_map[section] end
|
||||||
for _, mode in ipairs(modes) do
|
for _, mode in ipairs(modes) do
|
||||||
local highlight_group_name = {options.self.section, highlight_tag, mode}
|
local highlight_group_name = {options.self.section, highlight_tag, mode}
|
||||||
local default_color_table = active_theme[mode] and
|
local default_color_table = active_theme[mode] and
|
||||||
|
@ -139,7 +140,8 @@ function M.component_format_highlight(highlight_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.format_highlight(is_focused, highlight_group)
|
function M.format_highlight(is_focused, highlight_group)
|
||||||
if highlight_group > 'lualine_c' then
|
if highlight_group > 'lualine_c'
|
||||||
|
and not utils.highlight_exists(highlight_group .. '_normal') then
|
||||||
highlight_group = 'lualine_' ..
|
highlight_group = 'lualine_' ..
|
||||||
section_highlight_map[highlight_group:match(
|
section_highlight_map[highlight_group:match(
|
||||||
'lualine_(.)')]
|
'lualine_(.)')]
|
||||||
|
|
Loading…
Reference in New Issue