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 yellow = colors.yellow
|
||||
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
|
||||
cmd "hi clear CursorLine"
|
||||
-- Line number
|
||||
fg("cursorlinenr", white)
|
||||
|
||||
-- same it bg, so it doesn't appear
|
||||
fg("EndOfBuffer", black)
|
||||
-- highlight groups & colors
|
||||
local hl_cols = {
|
||||
|
||||
-- For floating windows
|
||||
fg("FloatBorder", blue)
|
||||
bg("NormalFloat", darker_black)
|
||||
Comment = { fg = grey_fg },
|
||||
|
||||
-- Pmenu
|
||||
bg("Pmenu", one_bg)
|
||||
bg("PmenuSbar", one_bg2)
|
||||
bg("PmenuSel", pmenu_bg)
|
||||
bg("PmenuThumb", nord_blue)
|
||||
fg("CmpItemAbbr", white)
|
||||
fg("CmpItemAbbrMatch", white)
|
||||
fg("CmpItemKind", white)
|
||||
fg("CmpItemMenu", white)
|
||||
-- line numbers
|
||||
CursorLineNr = { fg = white },
|
||||
LineNr = { fg = grey },
|
||||
|
||||
-- misc
|
||||
-- those ugly ~'s
|
||||
EndOfBuffer = { fg = black },
|
||||
|
||||
-- inactive statuslines as thin lines
|
||||
fg("StatusLineNC", one_bg3 .. " gui=underline")
|
||||
-- floating windows
|
||||
FloatBorder = { fg = blue },
|
||||
NormalFloat = { bg = darker_black },
|
||||
|
||||
fg("LineNr", grey)
|
||||
fg("NvimInternalError", red)
|
||||
fg("WinSeparator", one_bg2)
|
||||
-- Pmenu i.e completion menu
|
||||
Pmenu = { bg = one_bg },
|
||||
PmenuSbar = { bg = one_bg2 },
|
||||
PmenuSel = { bg = pmenu_bg, fg = black },
|
||||
PmenuThumb = { bg = nord_blue },
|
||||
|
||||
if ui.transparency then
|
||||
bg("Normal", "NONE")
|
||||
bg("Folded", "NONE")
|
||||
fg("Folded", "NONE")
|
||||
fg("Comment", grey)
|
||||
end
|
||||
-- nvim cmp
|
||||
CmpItemAbbr = { fg = white },
|
||||
CmpItemAbbrMatch = { fg = white },
|
||||
CmpItemKind = { fg = white },
|
||||
CmpItemMenu = { fg = white },
|
||||
|
||||
-- [[ Plugin Highlights
|
||||
NvimInternalError = { fg = red },
|
||||
WinSeparator = { fg = one_bg2 },
|
||||
|
||||
-- Dashboard
|
||||
fg("AlphaHeader", grey_fg)
|
||||
fg("AlphaButtons", light_grey)
|
||||
-- Dashboard i.e alpha.nvim
|
||||
AlphaHeader = { fg = grey_fg },
|
||||
AlphaButtons = { fg = light_grey },
|
||||
|
||||
-- Git signs
|
||||
fg_bg("DiffAdd", blue, "NONE")
|
||||
fg_bg("DiffChange", grey_fg, "NONE")
|
||||
fg_bg("DiffChangeDelete", red, "NONE")
|
||||
fg_bg("DiffModified", red, "NONE")
|
||||
fg_bg("DiffDelete", red, "NONE")
|
||||
-- Gitsigns.nvim
|
||||
DiffAdd = {
|
||||
fg = blue,
|
||||
bg = "NONE",
|
||||
},
|
||||
|
||||
-- Indent blankline plugin
|
||||
fg("IndentBlanklineChar", line)
|
||||
fg("IndentBlanklineSpaceChar", line)
|
||||
DiffChange = {
|
||||
fg = light_grey,
|
||||
bg = "NONE",
|
||||
},
|
||||
|
||||
-- Lsp diagnostics
|
||||
DiffChangeDelete = {
|
||||
fg = red,
|
||||
bg = "NONE",
|
||||
},
|
||||
|
||||
fg("DiagnosticHint", purple)
|
||||
fg("DiagnosticError", red)
|
||||
fg("DiagnosticWarn", yellow)
|
||||
fg("DiagnosticInformation", green)
|
||||
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
|
||||
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)
|
||||
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
|
||||
fg_bg("TelescopeBorder", darker_black, darker_black)
|
||||
fg_bg("TelescopePromptBorder", black2, black2)
|
||||
TelescopeBorder = {
|
||||
fg = darker_black,
|
||||
bg = darker_black,
|
||||
},
|
||||
|
||||
fg_bg("TelescopePromptNormal", white, black2)
|
||||
fg_bg("TelescopePromptPrefix", red, black2)
|
||||
TelescopePromptBorder = {
|
||||
fg = black2,
|
||||
bg = black2,
|
||||
},
|
||||
|
||||
bg("TelescopeNormal", darker_black)
|
||||
TelescopePromptNormal = {
|
||||
fg = white,
|
||||
bg = black2,
|
||||
},
|
||||
|
||||
fg_bg("TelescopePreviewTitle", black, green)
|
||||
fg_bg("TelescopePromptTitle", black, red)
|
||||
fg_bg("TelescopeResultsTitle", darker_black, darker_black)
|
||||
TelescopePromptPrefix = {
|
||||
fg = red,
|
||||
bg = black2,
|
||||
},
|
||||
|
||||
bg("TelescopeSelection", 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 },
|
||||
}
|
||||
|
||||
-- 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")
|
||||
local hl_groups = {
|
||||
"NormalFloat",
|
||||
"Normal",
|
||||
"Folded",
|
||||
"NvimTreeNormal",
|
||||
"NvimTreeNormalNC",
|
||||
"TelescopeNormal",
|
||||
"TelescopePrompt",
|
||||
"TelescopeResults",
|
||||
"TelescopeBorder",
|
||||
"TelescopePromptBorder",
|
||||
"TelescopePromptNormal",
|
||||
"TelescopePromptPrefix",
|
||||
}
|
||||
|
||||
-- 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)
|
||||
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
|
||||
|
||||
local utils = require "core.utils"
|
||||
local user_highlights = utils.load_config().ui.hl_override
|
||||
|
||||
-- override user highlights if there are any
|
||||
hl_cols = vim.tbl_deep_extend("force", hl_cols, user_highlights)
|
||||
|
||||
for hl, col in pairs(hl_cols) do
|
||||
vim.api.nvim_set_hl(0, hl, col)
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@ M.options = {
|
|||
---- UI -----
|
||||
|
||||
M.ui = {
|
||||
hl_override = "",
|
||||
hl_override = {},
|
||||
colors = "", -- path of your file that contains colors
|
||||
theme = "onedark", -- default theme
|
||||
transparency = false,
|
||||
|
|
Loading…
Reference in a new issue