nvim: switch between light and dark theme

This commit is contained in:
nicolas 2023-09-16 23:13:43 +02:00
parent 1ba8e9f528
commit 9e230454bb
6 changed files with 88 additions and 98 deletions

View File

@ -1,7 +1,3 @@
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#243940 gui=nocombine]]
vim.cmd [[highlight IndentBlanklineSpaceChar guifg=#243940 gui=nocombine]]
vim.cmd [[highlight WhiteSpace guifg=#243940 gui=nocombine]]
vim.opt.list = true
vim.opt.listchars:append "space:·,trail: "

View File

@ -1,52 +0,0 @@
local colors = {
base03 = '#002b36',
base02 = '#073642',
base01 = '#586e75',
base00 = '#657b83',
base0 = '#839496',
base1 = '#93a1a1',
base2 = '#eee8d5',
base3 = '#fdf6e3',
yellow = '#b58900',
orange = '#cb4b16',
red = '#dc322f',
magenta = '#d33682',
violet = '#6c71c4',
blue = '#268bd2',
cyan = '#2aa198',
green = '#859900',
}
require('lualine').setup {
options = {
theme = 'solarized'
},
sections = {
lualine_b = {
'branch',
},
lualine_c = {
{
'diagnostics',
diagnostics_color = {
error = { fg = colors.red, bg = colors.base02, gui = 'bold' },
warn = { fg = colors.yellow, bg = colors.base02, gui = 'bold' },
info = { fg = colors.blue, bg = colors.base02, gui = 'bold' },
hint = { fg = colors.cyan, bg = colors.base02, gui = 'bold' },
}
},
{
'diff',
diff_color = {
added = 'DiffAdd',
modified = 'DiffChange',
removed = 'DiffDelete',
},
},
{
'filename',
path = 1
}
}
}
}

View File

@ -1,31 +0,0 @@
local status, n = pcall(require, "neosolarized")
if (not status) then return end
n.setup({
comment_italics = true,
background_set = true
})
local cb = require('colorbuddy.init')
local colors = cb.colors
local Group = cb.Group
local groups = cb.groups
local styles = cb.styles
local cHint = groups.Hint.fg
local cWarn = groups.Warning.fg
local cInfo = groups.Information.fg
local cError = groups.Error.fg
Group.new('NormalNC', colors.base0, colors.base03, styles.NONE)
Group.new('CursorLineNr', colors.magenta, colors.base03, styles.NONE, colors.base1)
Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.undercurl, cError)
Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.undercurl, cWarn)
Group.new("DiagnosticUnderlineInfo", colors.none, colors.none, styles.undercurl, cInfo)
Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.undercurl, cHint)

View File

@ -2,3 +2,4 @@ require('nise.plugins')
require('nise.options')
require('nise.keymaps')
require('nise.completion')
require('nise.theme').setup()

View File

@ -41,8 +41,6 @@ opt.shortmess:append "c"
opt.linebreak = true
opt.breakindent = true
vim.cmd('colorscheme neosolarized')
require 'colorizer'.setup { '*'; }
vim.cmd [[

View File

@ -1,9 +1,77 @@
local M = {}
local fmt = string.format
function M.toggle()
vim.cmd('colorscheme dayfox')
require 'lualine'.setup({
local function init_solarized()
local function diagnostics_color(foreground_color)
return { fg = foreground_color, bg = '#073642', gui = 'bold' }
end
vim.o.bg = 'dark'
local new_theme = 'neosolarized'
vim.cmd.colorscheme(new_theme)
require 'neosolarized'.setup { background_set = true }
require 'lualine'.setup {
options = {
theme = 'solarized'
},
sections = {
lualine_b = {
'branch',
},
lualine_c = {
{
'diagnostics',
diagnostics_color = {
error = diagnostics_color('#dc322f'),
warn = diagnostics_color('#b58900'),
info = diagnostics_color('#268bd2'),
hint = diagnostics_color('#2aa198'),
}
},
{
'diff',
diff_color = {
added = 'DiffAdd',
modified = 'DiffChange',
removed = 'DiffDelete',
},
},
{
'filename',
path = 1
}
}
}
}
local cb = require('colorbuddy.init')
local colors = cb.colors
local Group = cb.Group
local groups = cb.groups
local styles = cb.styles
local cHint = groups.Hint.fg
local cWarn = groups.Warning.fg
local cInfo = groups.Information.fg
local cError = groups.Error.fg
Group.new('NormalNC', colors.base0, colors.base03, styles.NONE)
Group.new('CursorLineNr', colors.magenta, colors.base03, styles.NONE, colors.base1)
Group.new("DiagnosticVirtualTextError", cError, cError:dark():dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextWarn", cWarn, cWarn:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextInfo", cInfo, cInfo:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticVirtualTextHint", cHint, cHint:dark():dark():dark(), styles.NONE)
Group.new("DiagnosticUnderlineError", colors.none, colors.none, styles.undercurl, cError)
Group.new("DiagnosticUnderlineWarn", colors.none, colors.none, styles.undercurl, cWarn)
Group.new("DiagnosticUnderlineInfo", colors.none, colors.none, styles.undercurl, cInfo)
Group.new("DiagnosticUnderlineHint", colors.none, colors.none, styles.undercurl, cHint)
vim.cmd [[highlight IndentBlanklineIndent1 guifg=#243940 gui=nocombine]]
vim.cmd [[highlight WhiteSpace guifg=#243940 gui=nocombine]]
end
local function init_dayfox()
local new_theme = 'dayfox'
vim.cmd.colorscheme(new_theme)
require 'lualine'.setup {
options = {
theme = 'dayfox'
},
@ -20,12 +88,22 @@ function M.toggle()
}
}
}
})
}
local bg0 = require('nightfox.palette.dayfox').palette.bg0
vim.cmd(fmt([[highlight IndentBlanklineIndent1 guifg=%s gui=nocombine]], bg0))
vim.cmd(fmt([[highlight IndentBlanklineSpaceChar guifg=%s gui=nocombine]], bg0))
vim.cmd(fmt([[highlight WhiteSpace guifg=%s gui=nocombine]], bg0))
vim.cmd(string.format("highlight IndentBlanklineIndent1 guifg=%s gui=nocombine", bg0))
end
function M.toggle()
local current_theme = vim.g.colors_name
if current_theme == 'neosolarized' then
init_dayfox()
else
init_solarized()
end
end
function M.setup()
init_solarized()
end
return M