Created
August 2, 2025 03:59
-
-
Save dladukedev/8767f35f5e2987898c9c52dd98ae2137 to your computer and use it in GitHub Desktop.
Better Default Neovim Theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local theme = { | |
fg = vim.o.background == 'dark' and 'NvimLightGrey2' or 'NvimDarkGrey2', | |
fg_dim = vim.o.background == 'dark' and 'NvimLightGrey3' or 'NvimDarkGrey3', | |
nontext = vim.o.background == 'dark' and 'NvimLightGrey4' or 'NvimDarkGrey4', | |
bg = vim.o.background == 'dark' and 'NvimDarkGrey2' or 'NvimLightGrey2', | |
variable = vim.o.background == 'dark' and 'NvimLightGrey2' or 'NvimDarkGrey2', | |
number = vim.o.background == 'dark' and 'NvimLightMagenta' or 'NvimDarkMagenta', | |
string = vim.o.background == 'dark' and 'NvimLightGreen' or 'NvimDarkGreen', | |
identifier = vim.o.background == 'dark' and 'NvimLightYellow' or 'NvimDarkYellow', | |
fun = vim.o.background == 'dark' and 'NvimLightCyan' or 'NvimDarkCyan', | |
keyword = vim.o.background == 'dark' and 'NvimLightBlue' or 'NvimDarkBlue', | |
type = vim.o.background == 'dark' and 'NvimLightCyan' or 'NvimDarkCyan', | |
constant = vim.o.background == 'dark' and 'NvimLightMagenta' or 'NvimDarkMagenta', | |
special = vim.o.background == 'dark' and 'NvimLightBlue' or 'NvimDarkBlue', | |
selection = vim.o.background == 'dark' and 'NvimDarkBlue' or 'NvimLightBlue', | |
highlight = vim.o.background == 'dark' and 'NvimLightGrey1' or 'NvimDarkGrey1', | |
add = vim.o.background == 'dark' and 'NvimLightGreen' or 'NvimDarkGreen', | |
delete = vim.o.background == 'dark' and 'NvimLightRed' or 'NvimDarkRed', | |
change = vim.o.background == 'dark' and 'NvimLightYellow' or 'NvimDarkYellow', | |
add_bg = vim.o.background == 'dark' and 'NvimDarkGreen' or 'NvimLightGreen', | |
delete_bg = vim.o.background == 'dark' and 'NvimDarkRed' or 'NvimLightRed', | |
change_bg = vim.o.background == 'dark' and 'NvimDarkYellow' or 'NvimLightYellow', | |
text_bg = vim.o.background == 'dark' and 'NvimDarkBlue' or 'NvimLightBlue', | |
ok = vim.o.background == 'dark' and 'NvimLightGreen' or 'NvimDarkGreen', | |
error = vim.o.background == 'dark' and 'NvimLightRed' or 'NvimDarkRed', | |
warning = vim.o.background == 'dark' and 'NvimLightYellow' or 'NvimDarkYellow', | |
info = vim.o.background == 'dark' and 'NvimLightBlue' or 'NvimDarkBlue', | |
hint = vim.o.background == 'dark' and 'NvimLightCyan' or 'NvimDarkCyan', | |
} | |
-- Base | |
vim.api.nvim_set_hl(0, "Normal", { fg = theme.fg, bg = theme.bg }) | |
vim.api.nvim_set_hl(0, "Secondary", { fg = theme.fg_dim }) | |
vim.api.nvim_set_hl(0, "NonText", { fg = theme.nontext }) | |
vim.api.nvim_set_hl(0, "HighlightText", { fg = theme.highlight, bold = true }) | |
vim.api.nvim_set_hl(0, "Special", { fg = theme.special }) | |
vim.api.nvim_set_hl(0, "Bold", { bold = true }) | |
-- Hidden | |
vim.api.nvim_set_hl(0, "Hidden", { bg = theme.bg }) | |
vim.api.nvim_set_hl(0, "HiddenText", { fg = theme.bg }) | |
-- Search and Selection | |
vim.api.nvim_set_hl(0, "Visual", { bg = theme.selection }) | |
vim.api.nvim_set_hl(0, "Cursor", { fg = 'none', bg = theme.fg }) | |
vim.api.nvim_set_hl(0, "Search", { fg = theme.fg, bg = theme.selection }) | |
vim.api.nvim_set_hl(0, "CurSearch", { fg = theme.bg, bg = theme.info }) | |
vim.api.nvim_set_hl(0, "Substitute", { fg = theme.fg, bg = theme.change }) | |
-- Coding | |
vim.api.nvim_set_hl(0, "Function", { fg = theme.fun }) | |
vim.api.nvim_set_hl(0, "Identifier", { fg = theme.identifier }) | |
vim.api.nvim_set_hl(0, "Keyword", { fg = theme.keyword }) | |
vim.api.nvim_set_hl(0, "Variable", { fg = theme.variable }) | |
vim.api.nvim_set_hl(0, "Comment", { fg = theme.nontext, italic = true }) | |
vim.api.nvim_set_hl(0, "Constant", { fg = theme.constant }) | |
vim.api.nvim_set_hl(0, "String", { fg = theme.string }) | |
vim.api.nvim_set_hl(0, "Number", { fg = theme.number }) | |
vim.api.nvim_set_hl(0, "Statement", { fg = theme.special }) | |
vim.api.nvim_set_hl(0, "Type", { fg = theme.type }) | |
-- Message Context | |
vim.api.nvim_set_hl(0, "Error", { fg = theme.error }) | |
vim.api.nvim_set_hl(0, "Info", { fg = theme.info }) | |
vim.api.nvim_set_hl(0, "Warn", { fg = theme.warning }) | |
vim.api.nvim_set_hl(0, "Hint", { fg = theme.hint }) | |
vim.api.nvim_set_hl(0, "Ok", { fg = theme.ok }) | |
vim.api.nvim_set_hl(0, "UnderlineError", { undercurl = true, sp = theme.error }) | |
vim.api.nvim_set_hl(0, "UnderlineWarn", { undercurl = true, sp = theme.warning }) | |
vim.api.nvim_set_hl(0, "UnderlineInfo", { undercurl = true, sp = theme.info }) | |
vim.api.nvim_set_hl(0, "UnderlineHint", { undercurl = true, sp = theme.hint }) | |
-- Diff | |
vim.api.nvim_set_hl(0, "Added", { fg = theme.add }) | |
vim.api.nvim_set_hl(0, "Removed", { fg = theme.delete }) | |
vim.api.nvim_set_hl(0, "Changed", { fg = theme.change }) | |
vim.api.nvim_set_hl(0, "AddStaged", { fg = theme.add, bold = true }) | |
vim.api.nvim_set_hl(0, "RemoveStaged", { fg = theme.delete, bold = true }) | |
vim.api.nvim_set_hl(0, "ChangeStaged", { fg = theme.change, bold = true }) | |
vim.api.nvim_set_hl(0, "DiffAdd", { bg = theme.add_bg }) | |
vim.api.nvim_set_hl(0, "DiffChange", { bg = theme.change_bg }) | |
vim.api.nvim_set_hl(0, "DiffDelete", { bg = theme.delete_bg }) | |
vim.api.nvim_set_hl(0, "DiffText", { bg = theme.text_bg }) | |
-- Other Linked | |
vim.api.nvim_set_hl(0, "Operator", { link = "Keyword" }) | |
vim.api.nvim_set_hl(0, "Whitespace", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "Delimiter", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "PreProc", { link = "Keyword" }) | |
vim.api.nvim_set_hl(0, "Ignore", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "QuickFixLine", { link = "lineNr" }) | |
vim.api.nvim_set_hl(0, "qfFileName", { link = "Directory" }) | |
vim.api.nvim_set_hl(0, "SpecialKey", { link = "Special" }) | |
vim.api.nvim_set_hl(0, "Conceal", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "Directory", { link = "Keyword" }) | |
-- Messages | |
vim.api.nvim_set_hl(0, "MsgArea", { link = 'StatusLine' }) | |
vim.api.nvim_set_hl(0, "ModeMsg", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "MoreMsg", { link = "Info" }) | |
vim.api.nvim_set_hl(0, "Question", { link = "Info" }) | |
vim.api.nvim_set_hl(0, "ErrorMsg", { link = "Error" }) | |
vim.api.nvim_set_hl(0, "WarningMsg", { link = "Warn" }) | |
-- UI | |
vim.api.nvim_set_hl(0, "lCursor", { link = "Cursor" }) | |
-- vim.api.nvim_set_hl(0, "CursorLine", { link = "Hidden" }) | |
-- vim.api.nvim_set_hl(0, "CursorLineNr", { link = "HighlightText" }) | |
vim.api.nvim_set_hl(0, "EndOfBuffer", { link = "HiddenText" }) | |
vim.api.nvim_set_hl(0, "Folded", { link = "HighlightText" }) | |
vim.api.nvim_set_hl(0, "FoldColumn", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "LineNr", { link = "Secondary" }) | |
vim.api.nvim_set_hl(0, "MatchParen", { link = "HighlightText" }) | |
vim.api.nvim_set_hl(0, "SignColumn", { link = "Keyword" }) | |
vim.api.nvim_set_hl(0, "StatusLine", { link = "Secondary" }) | |
vim.api.nvim_set_hl(0, "StatusLineNC", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "Title", { link = "HighlightText" }) | |
vim.api.nvim_set_hl(0, "WinSeparator", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "WinBar", { link = "Secondary" }) | |
vim.api.nvim_set_hl(0, "WinBarNC", { link = "NonText" }) | |
-- Floats & Menus | |
vim.api.nvim_set_hl(0, "FloatBorder", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "FloatTitle", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "FloatFooter", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "NormalFloat", { link = 'Normal' }) | |
vim.api.nvim_set_hl(0, "Pmenu", { link = 'NormalFloat' }) | |
vim.api.nvim_set_hl(0, "PmenuSel", { link = "Visual" }) | |
vim.api.nvim_set_hl(0, "PmenuSbar", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "PmenuThumb", { link = "NonText" }) | |
-- Spell Check | |
vim.api.nvim_set_hl(0, "SpellBad", { link = "UnderlineError" }) | |
vim.api.nvim_set_hl(0, "SpellCap", { link = "UnderlineWarn" }) | |
vim.api.nvim_set_hl(0, "SpellLocal", { link = "UnderlineWarn" }) | |
vim.api.nvim_set_hl(0, "SpellRare", { link = "UnderlineWarn" }) | |
-- Diagnostics | |
vim.api.nvim_set_hl(0, "DiagnosticError", { link = "Error" }) | |
vim.api.nvim_set_hl(0, "DiagnosticWarn", { link = "Warn" }) | |
vim.api.nvim_set_hl(0, "DiagnosticInfo", { link = "Info" }) | |
vim.api.nvim_set_hl(0, "DiagnosticHint", { link = "Hint" }) | |
vim.api.nvim_set_hl(0, "DiagnosticOk", { link = "Ok" }) | |
vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { link = "UnderlineError" }) | |
vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { link = "UnderlineWarn" }) | |
vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { link = "UnderlineInfo" }) | |
vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { link = "UnderlineHint" }) | |
-- LSP | |
vim.api.nvim_set_hl(0, "@variable", { link = "Variable" }) | |
vim.api.nvim_set_hl(0, "@variable.member", { link = "Identifier" }) | |
vim.api.nvim_set_hl(0, "@constructor.lua", { link = "NonText" }) | |
vim.api.nvim_set_hl(0, "@lsp.type.variable", { fg = "none" }) | |
vim.api.nvim_set_hl(0, "@lsp.typemod.variable.global", { link = "Constant" }) | |
vim.api.nvim_set_hl(0, "@lsp.typemod.variable.static", { link = "Constant" }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment