Skip to content

Commit

Permalink
Add support for base16-vim alongside nvim-base16 (nvim-lualine#1006)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden authored and craigmac committed May 15, 2024
1 parent 1e8cffc commit 0e4586f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion THEMES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
24 changes: 22 additions & 2 deletions lua/lualine/themes/base16.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

0 comments on commit 0e4586f

Please sign in to comment.