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
@ -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 },
|
||||
|
||||
-- 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
|
||||
bg("Normal", "NONE")
|
||||
bg("Folded", "NONE")
|
||||
fg("Folded", "NONE")
|
||||
fg("Comment", grey)
|
||||
local hl_groups = {
|
||||
"NormalFloat",
|
||||
"Normal",
|
||||
"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
|
||||
|
||||
-- [[ Plugin Highlights
|
||||
local utils = require "core.utils"
|
||||
local user_highlights = utils.load_config().ui.hl_override
|
||||
|
||||
-- Dashboard
|
||||
fg("AlphaHeader", grey_fg)
|
||||
fg("AlphaButtons", light_grey)
|
||||
-- override user highlights if there are any
|
||||
hl_cols = vim.tbl_deep_extend("force", hl_cols, user_highlights)
|
||||
|
||||
-- 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")
|
||||
|
||||
-- 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)
|
||||
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 New Issue
Block a user