Themes now fallback to normal mode theme (#28)
* Themes now fallback to normal mode theme * Refactored apply_default function * refactoring apply defaults
This commit is contained in:
parent
24db1a62e8
commit
6da4406a5a
|
@ -10,7 +10,22 @@ local function highlight (name, foreground, background, special)
|
|||
return table.concat(command, ' ')
|
||||
end
|
||||
|
||||
local function apply_defaults_to_theme(theme)
|
||||
local modes = {'insert', 'visual', 'replace', 'command', 'terminal', 'inactive'}
|
||||
for _, mode in ipairs(modes) do
|
||||
if not theme[mode] then
|
||||
theme[mode] = theme['normal']
|
||||
else
|
||||
for section_name, section in pairs(theme['normal']) do
|
||||
theme[mode][section_name] = (theme[mode][section_name] or section)
|
||||
end
|
||||
end
|
||||
end
|
||||
return theme
|
||||
end
|
||||
|
||||
function M.create_highlight_groups(theme)
|
||||
apply_defaults_to_theme(theme)
|
||||
for mode, sections in pairs(theme) do
|
||||
for section, colorscheme in pairs(sections) do
|
||||
local special = nil
|
||||
|
|
Loading…
Reference in New Issue