From 00da5c690f4213259d50cb181d49570aa7486a80 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Wed, 5 Jul 2023 14:14:29 +0530 Subject: [PATCH] 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. --- nvim/.config/nvim/colors/yolokai.vim | 6 +----- nvim/.config/nvim/lua/yolokai.lua | 27 +-------------------------- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/nvim/.config/nvim/colors/yolokai.vim b/nvim/.config/nvim/colors/yolokai.vim index 539b73e..5778528 100644 --- a/nvim/.config/nvim/colors/yolokai.vim +++ b/nvim/.config/nvim/colors/yolokai.vim @@ -706,13 +706,9 @@ local highlight_groups = { MiniJump2dSpotAhead = { fg = white, style={ 'nocombine' }}, } --- We do not care about terminals which do not support 256 colors -local terminal_ansi_colors = { } - require('yolokai')( highlight_group_normal, - highlight_groups, - terminal_ansi_colors + highlight_groups ) EOF diff --git a/nvim/.config/nvim/lua/yolokai.lua b/nvim/.config/nvim/lua/yolokai.lua index 392da44..16472bc 100644 --- a/nvim/.config/nvim/lua/yolokai.lua +++ b/nvim/.config/nvim/lua/yolokai.lua @@ -1,5 +1,3 @@ ---[[ NOTHING INSIDE THIS FILE NEEDS TO BE EDITED BY THE USER. ]] - --- @class Yolokai.Definition --- @field bg? string|table the background color --- @field blend? number the transparency value @@ -13,12 +11,6 @@ --[[/* 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. local _PALETTE_HEX = 1 @@ -104,9 +96,6 @@ function yolokai.highlight(group_name, definition) -- {{{ † highlight.bg = get(definition.bg, _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 local style = definition.style @@ -126,15 +115,7 @@ function yolokai.highlight(group_name, definition) -- {{{ † vim.api.nvim_set_hl(0, group_name, highlight) end --}}} ‡ ---- Set `g:terminal_color_`s based on `terminal_colors`. ---- @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) +return setmetatable(yolokai, {__call = function(self, normal, highlights) --- resolve highlight groups being defined by function calls. --- @param tbl table the current table being indexed. --- @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 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. self.highlight('Normal', normal) @@ -175,7 +153,4 @@ return setmetatable(yolokai, {__call = function(self, normal, highlights, termin for group_name, _ in pairs(highlights) do self.highlight(group_name, resolve(highlights, group_name, false)) end - - -- Set the terminal highlight colors. - self:highlight_terminal(terminal_colors) end})