Skip to content

Commit

Permalink
feat: add better colors for cmp atom_colored theme
Browse files Browse the repository at this point in the history
  • Loading branch information
siduck committed Aug 22, 2024
1 parent 49294bf commit ce47400
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lua/base46/integrations/cmp.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local base16 = require("base46").get_theme_tb "base_16"
local colors = require("base46").get_theme_tb "base_30"
local mixcolors = require("base46.colors").mix

local highlights = {
CmpItemAbbr = { fg = colors.white },
Expand Down Expand Up @@ -43,6 +44,7 @@ local item_kinds = {
CmpItemKindCopilot = { fg = colors.green },
CmpItemKindCodeium = { fg = colors.vibrant_green },
CmpItemKindTabNine = { fg = colors.baby_pink },
CmpItemKindSuperMaven = { fg = colors.yellow },
}

local cmp_ui = require("nvconfig").ui.cmp
Expand Down Expand Up @@ -96,21 +98,20 @@ local styles = {

local generate_color = require("base46.colors").change_hex_lightness

local black2_l = generate_color(colors.black2, 6)
local black2_d = generate_color(colors.black2, -6)

-- override item_kind highlights for atom style
if cmp_ui.style == "atom" then
for key, value in pairs(item_kinds) do
item_kinds[key] = vim.tbl_deep_extend(
"force",
value,
{ bg = vim.o.bg == "dark" and generate_color(colors.black2, 6) or generate_color(colors.black2, -6) }
)
item_kinds[key] = vim.tbl_deep_extend("force", value, { bg = vim.o.bg == "dark" and black2_l or black2_d })
end
end

-- override item_kind highlights for atom_colored style
if cmp_ui.style == "atom_colored" then
for key, value in pairs(item_kinds) do
item_kinds[key] = { fg = colors.black, bg = generate_color(value.fg, -3), bold = true }
item_kinds[key] = { fg = value.fg, bg = mixcolors(value.fg, colors.black, 70) }
end
end

Expand Down

0 comments on commit ce47400

Please sign in to comment.