nvim: colors: Minor clean up
The call to highlight_terminal was redundant since we were passing just {}. Also remove cterm related settings. Upstream has diverged significantly, so we need not care about upstream any more.
This commit is contained in:
parent
549bc29b6f
commit
00da5c690f
2 changed files with 2 additions and 31 deletions
|
@ -706,13 +706,9 @@ local highlight_groups = {
|
||||||
MiniJump2dSpotAhead = { fg = white, style={ 'nocombine' }},
|
MiniJump2dSpotAhead = { fg = white, style={ 'nocombine' }},
|
||||||
}
|
}
|
||||||
|
|
||||||
-- We do not care about terminals which do not support 256 colors
|
|
||||||
local terminal_ansi_colors = { }
|
|
||||||
|
|
||||||
require('yolokai')(
|
require('yolokai')(
|
||||||
highlight_group_normal,
|
highlight_group_normal,
|
||||||
highlight_groups,
|
highlight_groups
|
||||||
terminal_ansi_colors
|
|
||||||
)
|
)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
--[[ NOTHING INSIDE THIS FILE NEEDS TO BE EDITED BY THE USER. ]]
|
|
||||||
|
|
||||||
--- @class Yolokai.Definition
|
--- @class Yolokai.Definition
|
||||||
--- @field bg? string|table the background color
|
--- @field bg? string|table the background color
|
||||||
--- @field blend? number the transparency value
|
--- @field blend? number the transparency value
|
||||||
|
@ -13,12 +11,6 @@
|
||||||
|
|
||||||
--[[/* Vars */]]
|
--[[/* Vars */]]
|
||||||
|
|
||||||
--- Which set of colors to use.
|
|
||||||
local _USE_256 = tonumber(vim.go.t_Co) > 255 or string.find(vim.env.TERM, '256')
|
|
||||||
|
|
||||||
--- Which index to use for `cterm` highlights.
|
|
||||||
local _PALETTE_CTERM = _USE_256 and 2 or 3
|
|
||||||
|
|
||||||
--- Which index to use for `gui` highlights.
|
--- Which index to use for `gui` highlights.
|
||||||
local _PALETTE_HEX = 1
|
local _PALETTE_HEX = 1
|
||||||
|
|
||||||
|
@ -104,9 +96,6 @@ function yolokai.highlight(group_name, definition) -- {{{ †
|
||||||
highlight.bg = get(definition.bg, _PALETTE_HEX)
|
highlight.bg = get(definition.bg, _PALETTE_HEX)
|
||||||
highlight.fg = get(definition.fg, _PALETTE_HEX)
|
highlight.fg = get(definition.fg, _PALETTE_HEX)
|
||||||
|
|
||||||
highlight.ctermbg = get(definition.bg, _PALETTE_CTERM)
|
|
||||||
highlight.ctermfg = get(definition.fg, _PALETTE_CTERM)
|
|
||||||
|
|
||||||
highlight.blend = definition.blend
|
highlight.blend = definition.blend
|
||||||
|
|
||||||
local style = definition.style
|
local style = definition.style
|
||||||
|
@ -126,15 +115,7 @@ function yolokai.highlight(group_name, definition) -- {{{ †
|
||||||
vim.api.nvim_set_hl(0, group_name, highlight)
|
vim.api.nvim_set_hl(0, group_name, highlight)
|
||||||
end --}}} ‡
|
end --}}} ‡
|
||||||
|
|
||||||
--- Set `g:terminal_color_`s based on `terminal_colors`.
|
return setmetatable(yolokai, {__call = function(self, normal, highlights)
|
||||||
--- @param terminal_colors table a list 1..16 of colors to use in the terminal
|
|
||||||
function yolokai:highlight_terminal(terminal_colors)
|
|
||||||
for index, color in ipairs(terminal_colors) do vim.g['terminal_color_'..(index-1)] =
|
|
||||||
vim.go.termguicolors and color[_PALETTE_HEX] or color[_PALETTE_CTERM]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable(yolokai, {__call = function(self, normal, highlights, terminal_colors)
|
|
||||||
--- resolve highlight groups being defined by function calls.
|
--- resolve highlight groups being defined by function calls.
|
||||||
--- @param tbl table the current table being indexed.
|
--- @param tbl table the current table being indexed.
|
||||||
--- @param key string the key to resolve the value for.
|
--- @param key string the key to resolve the value for.
|
||||||
|
@ -165,9 +146,6 @@ return setmetatable(yolokai, {__call = function(self, normal, highlights, termin
|
||||||
-- replace the colors_name
|
-- replace the colors_name
|
||||||
vim.g.colors_name = color_name
|
vim.g.colors_name = color_name
|
||||||
|
|
||||||
-- If we aren't using hex nor 256 colorsets.
|
|
||||||
if not (vim.go.termguicolors or _USE_256) then vim.go.t_Co = '16' end
|
|
||||||
|
|
||||||
-- Highlight the baseline.
|
-- Highlight the baseline.
|
||||||
self.highlight('Normal', normal)
|
self.highlight('Normal', normal)
|
||||||
|
|
||||||
|
@ -175,7 +153,4 @@ return setmetatable(yolokai, {__call = function(self, normal, highlights, termin
|
||||||
for group_name, _ in pairs(highlights) do
|
for group_name, _ in pairs(highlights) do
|
||||||
self.highlight(group_name, resolve(highlights, group_name, false))
|
self.highlight(group_name, resolve(highlights, group_name, false))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set the terminal highlight colors.
|
|
||||||
self:highlight_terminal(terminal_colors)
|
|
||||||
end})
|
end})
|
||||||
|
|
Loading…
Reference in a new issue