1
0
Fork 0

nvim: colors!

This commit is contained in:
Vladimír Dudr 2023-02-06 17:13:52 +01:00
parent b3b273ad45
commit 2fd61a090a
3 changed files with 176 additions and 25 deletions

View file

@ -0,0 +1,152 @@
local M = {};
M.pallete = {
dark0_hard = { '#1d2021', 234 },
dark0 = { '#282828', 235 },
dark0_soft = { '#32302f', 236 },
dark1 = { '#3c3836', 237 },
dark2 = { '#504945', 239 },
dark3 = { '#665c54', 241 },
dark4 = { '#7c6f64', 243 },
dark4_256 = { '#7c6f64', 243 },
gray = { '#928374', 245 },
gray_245 = { '#928374', 245 },
gray_244 = { '#928374', 244 },
light0_hard = { '#f9f5d7', 230 },
light0 = { '#fbf1c7', 229 },
light0_soft = { '#f2e5bc', 228 },
light1 = { '#ebdbb2', 223 },
light2 = { '#d5c4a1', 250 },
light3 = { '#bdae93', 248 },
light4 = { '#a89984', 246 },
light4_256 = { '#a89984', 246 },
bright_red = { '#fb4934', 167 },
bright_green = { '#b8bb26', 142 },
bright_yellow = { '#fabd2f', 214 },
bright_blue = { '#83a598', 109 },
bright_purple = { '#d3869b', 175 },
bright_aqua = { '#8ec07c', 108 },
bright_orange = { '#fe8019', 208 },
red = { '#cc241d', 124 },
green = { '#98971a', 106 },
yellow = { '#d79921', 172 },
blue = { '#458588', 66 },
purple = { '#b16286', 132 },
aqua = { '#689d6a', 72 },
orange = { '#d65d0e', 166 },
faded_red = { '#9d0006', 88 },
faded_green = { '#79740e', 100 },
faded_yellow = { '#b57614', 136 },
faded_blue = { '#076678', 24 },
faded_purple = { '#8f3f71', 96 },
faded_aqua = { '#427b58', 65 },
faded_orange = { '#af3a03', 130 },
none = { 'NONE', 'NONE' },
}
local aliases = {
error = 'red',
warn = 'orange',
info = 'bright_blue',
hint = 'aqua',
}
for alias, target in pairs(aliases) do
M.pallete[alias] = M.pallete[target]
end
-- colors type{{{
---@alias color
---|'dark0_hard'
---|'dark0'
---|'dark0_soft'
---|'dark1'
---|'dark2'
---|'dark3'
---|'dark4'
---|'dark4_256'
---|'gray'
---|'gray_245'
---|'gray_244'
---|'light0_hard'
---|'light0'
---|'light0_soft'
---|'light1'
---|'light2'
---|'light3'
---|'light4'
---|'light4_256'
---|'bright_red'
---|'bright_green'
---|'bright_yellow'
---|'bright_blue'
---|'bright_purple'
---|'bright_aqua'
---|'bright_orange'
---|'red'
---|'green'
---|'yellow'
---|'blue'
---|'purple'
---|'aqua'
---|'orange'
---|'faded_red'
---|'faded_green'
---|'faded_yellow'
---|'faded_blue'
---|'faded_purple'
---|'faded_aqua'
---|'faded_orange'
---|'error'
---|'warn'
---|'info'
---|'hint'
--}}}
-- style type {{{
--- @alias style
---|'bold'
---|'underline'
---|'undercurl'
---|'underdouble'
---|'underdotted'
---|'underdashed'
---|'strikethrough'
---|'reverse'
---|'inverse'
---|'italic'
---|'standout'
---|'nocombine'
NONE
-- }}}
---@param fg ?color
---@param bg ?color
---@param styles style[]
function M:hl(group, fg, bg, styles, opts)
local o = opts or {};
if fg ~= nil
then
o.fg = self.pallete[fg][1]
o.ctermfg = self.pallete[fg][2]
end
if bg ~= nil then
o.bg = self.pallete[bg][1]
o.ctermbg = self.pallete[bg][2]
end
for _, st in pairs(styles) do
o[st] = true
end
vim.api.nvim_set_hl(0, group, o)
end
return M

View file

@ -223,36 +223,29 @@ function M.config()
group = augr,
pattern = 'gruvbox',
callback = function()
vim.api.nvim_set_hl(0, 'Directory', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'TelescopeSelection', { link = 'GruvboxOrangeSign' })
vim.api.nvim_set_hl(0, 'TelescopeMatching', { link = 'GruvboxAqua' })
local gr = require('configs.colors')
vim.api.nvim_set_hl(0, 'NeoTreeGitAdded', { link = 'GruvboxGreen' })
vim.api.nvim_set_hl(0, 'NeoTreeGitDeleted', { link = 'GruvboxRed' })
vim.api.nvim_set_hl(0, 'NeoTreeGitModified', { link = 'GruvboxOrange' })
link('Directory', 'GruvboxGreen')
link('TelescopeSelection', 'GruvboxOrangeSign')
link('TelescopeMatching', 'GruvboxAqua')
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatch', { link = 'GruvboxAquaBold' })
vim.api.nvim_set_hl(0, 'CmpItemAbbrMatchFuzzy', { link = 'GruvboxAquaBold' })
link('NeoTreeGitAdded', 'GruvboxGreen')
link('NeoTreeGitDeleted', 'GruvboxRed')
link('NeoTreeGitModified', 'GruvboxOrange')
link('CmpItemAbbrMatch', 'GruvboxAquaBold')
link('CmpItemAbbrMatchFuzzy', 'GruvboxAquaBold')
local tbg = vim.api.nvim_get_hl_by_name('GruvboxBg0', false)
local bg = vim.api.nvim_get_hl_by_name('GruvboxBg0', true)
local tfg = vim.api.nvim_get_hl_by_name('GruvboxGray', false)
local fg = vim.api.nvim_get_hl_by_name('GruvboxGray', true)
vim.api.nvim_set_hl(0, 'LineNr',
{ fg = fg.foreground,
bg = bg.foreground,
ctermfg = tfg.foreground,
ctermbg = tbg.foreground,
underdotted = true
})
gr:hl('LineNr', 'gray', 'dark0_hard', { 'underdotted' })
gr:hl('LspCodeLens', 'gray', nil, { 'italic' })
gr:hl('IndentBlanklineContextChar', 'orange', nil, { 'nocombine' })
vim.api.nvim_set_hl(0, 'LspCodeLens', {
fg = fg.foreground,
ctermfg = tfg.foreground,
italic = true
})
gr:hl('DiagnosticVirtualTextError', 'error', nil, { 'italic' })
gr:hl('DiagnosticVirtualTextWarn', 'warn', nil, { 'italic' })
gr:hl('DiagnosticVirtualTextInfo', 'info', nil, { 'italic' })
gr:hl('DiagnosticVirtualTextHint', 'hint', nil, { 'italic' })
end
})

View file

@ -3,7 +3,13 @@ return {
{ 'AndrewRadev/linediff.vim', cmd = 'Linediff' },
{ 'lukas-reineke/indent-blankline.nvim', config = true },
{ 'lukas-reineke/indent-blankline.nvim', config = true, opts = {
show_current_context = true,
show_current_context_start = false,
}},
{ 'echasnovski/mini.surround', version = '*', config = function() require('mini.surround').setup({}) end },
-- { 'echasnovski/mini.indentscope', version = '*', config = function() require('mini.indentscope').setup({}) end },
{ 'echasnovski/mini.trailspace', version = '*', config = function() require('mini.trailspace').setup({}) end },
{
'numToStr/Comment.nvim',