Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading