Add support for base16-vim alongside nvim-base16 (#1006)

This commit is contained in:
Jamy 2024-04-05 11:33:34 +02:00 committed by GitHub
parent b5e8bb6421
commit 15d830d164
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 3 deletions

View file

@ -54,7 +54,7 @@ But if `g:ayuprefermirage` exists, it will load ayu_mirage instead when
### base16
This theme will automatically use colors defined by your colorscheme using [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
This theme will automatically use colors defined by your colorscheme using [tinted-theming/base16-vim](https://github.com/tinted-theming/base16-vim) or [RRethy/nvim-base16](https://github.com/RRethy/nvim-base16)] plugin.
The following example is using the `tomorrow-night` colorscheme:
<p>

View file

@ -50,7 +50,8 @@ local function setup_default()
}
end
local function setup_base16()
local function setup_base16_nvim()
-- Continue to load nvim-base16
local loaded, base16 = pcall(require, 'base16-colorscheme')
if not loaded then
@ -89,4 +90,23 @@ local function setup_base16()
}
end
return setup_base16() or setup_default()
local function setup_base16_vim()
-- Check if tinted-theming/base16-vim is already loaded
if vim.g.base16_gui00 and vim.g.base16_gui0F then
return setup {
bg = vim.g.base16_gui01,
alt_bg = vim.g.base16_gui02,
dark_fg = vim.g.base16_gui03,
fg = vim.g.base16_gui04,
light_fg = vim.g.base16_gui05,
normal = vim.g.base16_gui0D,
insert = vim.g.base16_gui0B,
visual = vim.g.base16_gui0E,
replace = vim.g.base16_gui09,
}
end
return nil
end
return setup_base16_vim() or setup_base16_nvim() or setup_default()