mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 21:00:38 +00:00
ease changing/adding highlight group colors
nvim_set_hl function from nvim v0.7 was used, now the highlight groups & their colors are in one whole table, can easily merge user highlghts override table, check https://nvchad.github.io/config/Custom%20config#override-default-highlights
This commit is contained in:
parent
841f839bb6
commit
89e271c095
2 changed files with 164 additions and 106 deletions
|
@ -22,124 +22,182 @@ local red = colors.red
|
||||||
local white = colors.white
|
local white = colors.white
|
||||||
local yellow = colors.yellow
|
local yellow = colors.yellow
|
||||||
local orange = colors.orange
|
local orange = colors.orange
|
||||||
local one_bg3 = colors.one_bg3
|
|
||||||
|
|
||||||
-- functions for setting highlights
|
|
||||||
local fg = require("core.utils").fg
|
|
||||||
local fg_bg = require("core.utils").fg_bg
|
|
||||||
local bg = require("core.utils").bg
|
|
||||||
|
|
||||||
-- Comments
|
|
||||||
fg("Comment", grey_fg)
|
|
||||||
|
|
||||||
-- Disable cursor line
|
-- Disable cursor line
|
||||||
cmd "hi clear CursorLine"
|
cmd "hi clear CursorLine"
|
||||||
-- Line number
|
|
||||||
fg("cursorlinenr", white)
|
|
||||||
|
|
||||||
-- same it bg, so it doesn't appear
|
-- highlight groups & colors
|
||||||
fg("EndOfBuffer", black)
|
local hl_cols = {
|
||||||
|
|
||||||
-- For floating windows
|
Comment = { fg = grey_fg },
|
||||||
fg("FloatBorder", blue)
|
|
||||||
bg("NormalFloat", darker_black)
|
|
||||||
|
|
||||||
-- Pmenu
|
-- line numbers
|
||||||
bg("Pmenu", one_bg)
|
CursorLineNr = { fg = white },
|
||||||
bg("PmenuSbar", one_bg2)
|
LineNr = { fg = grey },
|
||||||
bg("PmenuSel", pmenu_bg)
|
|
||||||
bg("PmenuThumb", nord_blue)
|
|
||||||
fg("CmpItemAbbr", white)
|
|
||||||
fg("CmpItemAbbrMatch", white)
|
|
||||||
fg("CmpItemKind", white)
|
|
||||||
fg("CmpItemMenu", white)
|
|
||||||
|
|
||||||
-- misc
|
-- those ugly ~'s
|
||||||
|
EndOfBuffer = { fg = black },
|
||||||
|
|
||||||
-- inactive statuslines as thin lines
|
-- floating windows
|
||||||
fg("StatusLineNC", one_bg3 .. " gui=underline")
|
FloatBorder = { fg = blue },
|
||||||
|
NormalFloat = { bg = darker_black },
|
||||||
|
|
||||||
fg("LineNr", grey)
|
-- Pmenu i.e completion menu
|
||||||
fg("NvimInternalError", red)
|
Pmenu = { bg = one_bg },
|
||||||
fg("WinSeparator", one_bg2)
|
PmenuSbar = { bg = one_bg2 },
|
||||||
|
PmenuSel = { bg = pmenu_bg, fg = black },
|
||||||
|
PmenuThumb = { bg = nord_blue },
|
||||||
|
|
||||||
|
-- nvim cmp
|
||||||
|
CmpItemAbbr = { fg = white },
|
||||||
|
CmpItemAbbrMatch = { fg = white },
|
||||||
|
CmpItemKind = { fg = white },
|
||||||
|
CmpItemMenu = { fg = white },
|
||||||
|
|
||||||
|
NvimInternalError = { fg = red },
|
||||||
|
WinSeparator = { fg = one_bg2 },
|
||||||
|
|
||||||
|
-- Dashboard i.e alpha.nvim
|
||||||
|
AlphaHeader = { fg = grey_fg },
|
||||||
|
AlphaButtons = { fg = light_grey },
|
||||||
|
|
||||||
|
-- Gitsigns.nvim
|
||||||
|
DiffAdd = {
|
||||||
|
fg = blue,
|
||||||
|
bg = "NONE",
|
||||||
|
},
|
||||||
|
|
||||||
|
DiffChange = {
|
||||||
|
fg = light_grey,
|
||||||
|
bg = "NONE",
|
||||||
|
},
|
||||||
|
|
||||||
|
DiffChangeDelete = {
|
||||||
|
fg = red,
|
||||||
|
bg = "NONE",
|
||||||
|
},
|
||||||
|
|
||||||
|
DiffModified = {
|
||||||
|
fg = orange,
|
||||||
|
bg = "NONE",
|
||||||
|
},
|
||||||
|
|
||||||
|
DiffDelete = {
|
||||||
|
fg = red,
|
||||||
|
bg = "NONE",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Indent blankline
|
||||||
|
IndentBlanklineChar = { fg = line },
|
||||||
|
IndentBlanklineSpaceChar = { fg = line },
|
||||||
|
|
||||||
|
-- Lsp Diagnostics
|
||||||
|
DiagnosticHint = { fg = purple },
|
||||||
|
DiagnosticError = { fg = red },
|
||||||
|
DiagnosticWarn = { fg = yellow },
|
||||||
|
DiagnosticInformation = { fg = green },
|
||||||
|
|
||||||
|
-- NvimTree
|
||||||
|
NvimTreeEmptyFolderName = { fg = folder_bg },
|
||||||
|
NvimTreeEndOfBuffer = { fg = darker_black },
|
||||||
|
NvimTreeFolderIcon = { fg = folder_bg },
|
||||||
|
NvimTreeFolderName = { fg = folder_bg },
|
||||||
|
NvimTreeGitDirty = { fg = red },
|
||||||
|
NvimTreeIndentMarker = { fg = one_bg2 },
|
||||||
|
NvimTreeNormal = { bg = darker_black },
|
||||||
|
NvimTreeNormalNC = { bg = darker_black },
|
||||||
|
NvimTreeOpenedFolderName = { fg = folder_bg },
|
||||||
|
|
||||||
|
NvimTreeWinSeparator = {
|
||||||
|
fg = darker_black,
|
||||||
|
bg = darker_black,
|
||||||
|
},
|
||||||
|
|
||||||
|
NvimTreeWindowPicker = {
|
||||||
|
fg = red,
|
||||||
|
bg = black2,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
TelescopeBorder = {
|
||||||
|
fg = darker_black,
|
||||||
|
bg = darker_black,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopePromptBorder = {
|
||||||
|
fg = black2,
|
||||||
|
bg = black2,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopePromptNormal = {
|
||||||
|
fg = white,
|
||||||
|
bg = black2,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopePromptPrefix = {
|
||||||
|
fg = red,
|
||||||
|
bg = black2,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopeNormal = { bg = darker_black },
|
||||||
|
|
||||||
|
TelescopePreviewTitle = {
|
||||||
|
fg = black,
|
||||||
|
bg = green,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopePromptTitle = {
|
||||||
|
fg = black,
|
||||||
|
bg = red,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopeResultsTitle = {
|
||||||
|
fg = darker_black,
|
||||||
|
bg = darker_black,
|
||||||
|
},
|
||||||
|
|
||||||
|
TelescopeSelection = { bg = black2 },
|
||||||
|
}
|
||||||
|
|
||||||
if ui.transparency then
|
if ui.transparency then
|
||||||
bg("Normal", "NONE")
|
local hl_groups = {
|
||||||
bg("Folded", "NONE")
|
"NormalFloat",
|
||||||
fg("Folded", "NONE")
|
"Normal",
|
||||||
fg("Comment", grey)
|
"Folded",
|
||||||
|
"NvimTreeNormal",
|
||||||
|
"NvimTreeNormalNC",
|
||||||
|
"TelescopeNormal",
|
||||||
|
"TelescopePrompt",
|
||||||
|
"TelescopeResults",
|
||||||
|
"TelescopeBorder",
|
||||||
|
"TelescopePromptBorder",
|
||||||
|
"TelescopePromptNormal",
|
||||||
|
"TelescopePromptPrefix",
|
||||||
|
}
|
||||||
|
|
||||||
|
for index, _ in ipairs(hl_groups) do
|
||||||
|
hl_cols[hl_groups[index]] = {
|
||||||
|
bg = "NONE",
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
hl_cols.NvimTreeWinSeparator = {
|
||||||
|
fg = grey,
|
||||||
|
bg = "NONE",
|
||||||
|
}
|
||||||
|
|
||||||
|
hl_cols.TelescopeResultsTitle = {
|
||||||
|
fg = black,
|
||||||
|
bg = blue,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- [[ Plugin Highlights
|
local utils = require "core.utils"
|
||||||
|
local user_highlights = utils.load_config().ui.hl_override
|
||||||
|
|
||||||
-- Dashboard
|
-- override user highlights if there are any
|
||||||
fg("AlphaHeader", grey_fg)
|
hl_cols = vim.tbl_deep_extend("force", hl_cols, user_highlights)
|
||||||
fg("AlphaButtons", light_grey)
|
|
||||||
|
|
||||||
-- Git signs
|
for hl, col in pairs(hl_cols) do
|
||||||
fg_bg("DiffAdd", blue, "NONE")
|
vim.api.nvim_set_hl(0, hl, col)
|
||||||
fg_bg("DiffChange", grey_fg, "NONE")
|
|
||||||
fg_bg("DiffChangeDelete", red, "NONE")
|
|
||||||
fg_bg("DiffModified", red, "NONE")
|
|
||||||
fg_bg("DiffDelete", red, "NONE")
|
|
||||||
|
|
||||||
-- Indent blankline plugin
|
|
||||||
fg("IndentBlanklineChar", line)
|
|
||||||
fg("IndentBlanklineSpaceChar", line)
|
|
||||||
|
|
||||||
-- Lsp diagnostics
|
|
||||||
|
|
||||||
fg("DiagnosticHint", purple)
|
|
||||||
fg("DiagnosticError", red)
|
|
||||||
fg("DiagnosticWarn", yellow)
|
|
||||||
fg("DiagnosticInformation", green)
|
|
||||||
|
|
||||||
-- NvimTree
|
|
||||||
fg("NvimTreeEmptyFolderName", folder_bg)
|
|
||||||
fg("NvimTreeEndOfBuffer", darker_black)
|
|
||||||
fg("NvimTreeFolderIcon", folder_bg)
|
|
||||||
fg("NvimTreeFolderName", folder_bg)
|
|
||||||
fg("NvimTreeGitDirty", red)
|
|
||||||
fg("NvimTreeIndentMarker", one_bg2)
|
|
||||||
bg("NvimTreeNormal", darker_black)
|
|
||||||
bg("NvimTreeNormalNC", darker_black)
|
|
||||||
fg("NvimTreeOpenedFolderName", folder_bg)
|
|
||||||
fg("NvimTreeRootFolder", red .. " gui=underline") -- enable underline for root folder in nvim tree
|
|
||||||
fg_bg("NvimTreeStatuslineNc", darker_black, darker_black)
|
|
||||||
fg_bg("NvimTreeWinSeparator", darker_black, darker_black)
|
|
||||||
fg_bg("NvimTreeWindowPicker", red, black2)
|
|
||||||
|
|
||||||
-- Telescope
|
|
||||||
fg_bg("TelescopeBorder", darker_black, darker_black)
|
|
||||||
fg_bg("TelescopePromptBorder", black2, black2)
|
|
||||||
|
|
||||||
fg_bg("TelescopePromptNormal", white, black2)
|
|
||||||
fg_bg("TelescopePromptPrefix", red, black2)
|
|
||||||
|
|
||||||
bg("TelescopeNormal", darker_black)
|
|
||||||
|
|
||||||
fg_bg("TelescopePreviewTitle", black, green)
|
|
||||||
fg_bg("TelescopePromptTitle", black, red)
|
|
||||||
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
|
|
||||||
|
|
||||||
bg("TelescopeSelection", black2)
|
|
||||||
|
|
||||||
-- Disable some highlight in nvim tree if transparency enabled
|
|
||||||
if ui.transparency then
|
|
||||||
bg("NormalFloat", "NONE")
|
|
||||||
bg("NvimTreeNormal", "NONE")
|
|
||||||
bg("NvimTreeNormalNC", "NONE")
|
|
||||||
bg("NvimTreeStatusLineNC", "NONE")
|
|
||||||
fg_bg("NvimTreeWinSeparator", grey, "NONE")
|
|
||||||
|
|
||||||
-- telescope
|
|
||||||
bg("TelescopeBorder", "NONE")
|
|
||||||
bg("TelescopePrompt", "NONE")
|
|
||||||
bg("TelescopeResults", "NONE")
|
|
||||||
bg("TelescopePromptBorder", "NONE")
|
|
||||||
bg("TelescopePromptNormal", "NONE")
|
|
||||||
bg("TelescopeNormal", "NONE")
|
|
||||||
bg("TelescopePromptPrefix", "NONE")
|
|
||||||
fg("TelescopeBorder", one_bg)
|
|
||||||
fg_bg("TelescopeResultsTitle", black, blue)
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,7 +18,7 @@ M.options = {
|
||||||
---- UI -----
|
---- UI -----
|
||||||
|
|
||||||
M.ui = {
|
M.ui = {
|
||||||
hl_override = "",
|
hl_override = {},
|
||||||
colors = "", -- path of your file that contains colors
|
colors = "", -- path of your file that contains colors
|
||||||
theme = "onedark", -- default theme
|
theme = "onedark", -- default theme
|
||||||
transparency = false,
|
transparency = false,
|
||||||
|
|
Loading…
Reference in a new issue