Skip to content

Commit

Permalink
feat(nvim-cmp): update CmpSel highlight
Browse files Browse the repository at this point in the history
fix code format
  • Loading branch information
zootedb0t committed Apr 29, 2024
1 parent 8509f4e commit 44c7ef5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lua/citruszest/highlights/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local M = {}
---@param a number between 0 and 1
---@return number
local blend = function(c, bg, a)
return math.floor(a * tonumber("0x"..c) + (1 - a) * tonumber("0x"..bg));
return math.floor(a * tonumber("0x" .. c) + (1 - a) * tonumber("0x" .. bg))
end

---@param hex string hex with 3 channels, ex: #00ff00
Expand All @@ -14,15 +14,15 @@ end
---@return string
local add_alpha = function(hex, bg, a)
if not bg:match("^#%x%x%x%x%x%x$") then
bg = "#121212"
bg = "#121212"
end
local r1, g1, b1 = hex:sub(2,3), hex:sub(4,5), hex:sub(6,7)
local r2, g2, b2 = bg:sub(2,3), bg:sub(4,5), bg:sub(6,7)
local r1, g1, b1 = hex:sub(2, 3), hex:sub(4, 5), hex:sub(6, 7)
local r2, g2, b2 = bg:sub(2, 3), bg:sub(4, 5), bg:sub(6, 7)
return "#" .. string.format("%02x%02x%02x", blend(r1, r2, a), blend(g1, g2, a), blend(b1, b2, a))
end

---@param C table
---@param O table
---@param C table of colors
---@param O table of option
---@return table
M.theme = function(C, O)
return {
Expand Down Expand Up @@ -146,7 +146,7 @@ M.theme = function(C, O)
diffFile = { fg = C.cyan },
diffLine = { fg = C.bright_cyan },
diffIndexLine = { fg = C.bright_black },
DiffAdd = { bg = add_alpha(C.green, C.background, 0.20)}, -- diff mode: Added line |diff.txt|
DiffAdd = { bg = add_alpha(C.green, C.background, 0.20) }, -- diff mode: Added line |diff.txt|
DiffChange = { bg = add_alpha(C.yellow, C.background, 0.20) }, -- diff mode: Changed line |diff.txt|
DiffDelete = { bg = add_alpha(C.bright_red, C.background, 0.20) }, -- diff mode: Deleted line |diff.txt|
DiffText = { bg = add_alpha(C.yellow, C.background, 0.35) }, -- diff mode: Changed text within a changed line |diff.txt|
Expand Down Expand Up @@ -417,7 +417,7 @@ M.theme = function(C, O)
CmpItemMenu = { fg = C.white },
CmpItemAbbrMatch = { fg = C.bright_green, bold = O.bold },
CmpItemAbbrMatchFuzzy = { fg = C.bright_green, bold = O.bold },
CmpSel = { fg = C.black, bg = C.baby_blue, bold = O.bold }, -- Visual mode selection
CmpSel = { fg = C.black, bg = add_alpha(C.baby_blue, C.background, 0.9), bold = O.bold }, -- Visual mode selection

-- kind colors
CmpItemKindSnippet = { fg = C.bright_cyan },
Expand Down

0 comments on commit 44c7ef5

Please sign in to comment.