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:
Shadman 2021-05-13 22:39:30 +06:00 committed by GitHub
parent 1ee99e0473
commit 634959f0e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -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.
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
local gruvbox = { }

View File

@ -95,7 +95,8 @@ function M.create_component_highlight_group(color, highlight_tag, options)
local normal_hl
-- convert lualine_a -> a before setting section
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
local highlight_group_name = {options.self.section, highlight_tag, mode}
local default_color_table = active_theme[mode] and
@ -139,7 +140,8 @@ function M.component_format_highlight(highlight_name)
end
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_' ..
section_highlight_map[highlight_group:match(
'lualine_(.)')]