Skip to content

Instantly share code, notes, and snippets.

@dladukedev
Last active August 4, 2025 02:32
Show Gist options
  • Save dladukedev/8767f35f5e2987898c9c52dd98ae2137 to your computer and use it in GitHub Desktop.
Save dladukedev/8767f35f5e2987898c9c52dd98ae2137 to your computer and use it in GitHub Desktop.
Default Neovim Colorscheme Improved in 100 Lines
-- Default Colorscheme Improved in 100 Lines
vim.cmd("hi clear")
local highlight = vim.o.background == 'dark' and 'NvimLightGrey1' or 'NvimDarkGrey1'
local fg = vim.o.background == 'dark' and 'NvimLightGrey2' or 'NvimDarkGrey2'
local fg_dim = vim.o.background == 'dark' and 'NvimLightGrey3' or 'NvimDarkGrey3'
local nontext = vim.o.background == 'dark' and 'NvimLightGrey4' or 'NvimDarkGrey4'
local bg = vim.o.background == 'dark' and 'NvimDarkGrey2' or 'NvimLightGrey2'
local red = vim.o.background == 'dark' and 'NvimLightRed' or 'NvimDarkRed'
local yellow = vim.o.background == 'dark' and 'NvimLightYellow' or 'NvimDarkYellow'
local green = vim.o.background == 'dark' and 'NvimLightGreen' or 'NvimDarkGreen'
local cyan = vim.o.background == 'dark' and 'NvimLightCyan' or 'NvimDarkCyan'
local blue = vim.o.background == 'dark' and 'NvimLightBlue' or 'NvimDarkBlue'
local magenta = vim.o.background == 'dark' and 'NvimLightMagenta' or 'NvimDarkMagenta'
local red_bg = vim.o.background == 'dark' and 'NvimDarkMagenta' or 'NvimLightMagenta'
local yellow_bg = vim.o.background == 'dark' and 'NvimDarkYellow' or 'NvimLightYellow'
local green_bg = vim.o.background == 'dark' and 'NvimDarkGreen' or 'NvimLightGreen'
local blue_bg = vim.o.background == 'dark' and 'NvimDarkBlue' or 'NvimLightBlue'
-- Base
vim.api.nvim_set_hl(0, "Normal", { fg = fg, bg = bg })
vim.api.nvim_set_hl(0, "Secondary", { fg = fg_dim })
vim.api.nvim_set_hl(0, "NonText", { fg = nontext })
vim.api.nvim_set_hl(0, "HighlightText", { fg = highlight, bold = true })
vim.api.nvim_set_hl(0, "Special", { fg = blue })
vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = bg })
-- Search and Selection
vim.api.nvim_set_hl(0, "Visual", { bg = blue_bg })
vim.api.nvim_set_hl(0, "Cursor", { fg = 'none', bg = fg })
vim.api.nvim_set_hl(0, "Search", { fg = fg, bg = blue_bg })
vim.api.nvim_set_hl(0, "CurSearch", { fg = bg, bg = blue })
vim.api.nvim_set_hl(0, "Substitute", { fg = fg, bg = yellow })
-- Coding
vim.api.nvim_set_hl(0, "Function", { fg = cyan })
vim.api.nvim_set_hl(0, "Identifier", { fg = yellow })
vim.api.nvim_set_hl(0, "Keyword", { fg = blue, italic = true })
vim.api.nvim_set_hl(0, "Variable", { fg = fg })
vim.api.nvim_set_hl(0, "Comment", { fg = nontext, italic = true })
vim.api.nvim_set_hl(0, "Constant", { fg = magenta })
vim.api.nvim_set_hl(0, "String", { fg = green })
vim.api.nvim_set_hl(0, "Statement", { fg = blue })
vim.api.nvim_set_hl(0, "Type", { fg = blue })
-- Message Context
vim.api.nvim_set_hl(0, "Error", { fg = red })
vim.api.nvim_set_hl(0, "DiagnosticError", { link = "Error" })
vim.api.nvim_set_hl(0, "DiagnosticWarn", { fg = yellow })
vim.api.nvim_set_hl(0, "DiagnosticInfo", { fg = blue })
vim.api.nvim_set_hl(0, "DiagnosticHint", { fg = cyan })
vim.api.nvim_set_hl(0, "DiagnosticOk", { fg = green })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { undercurl = true, sp = red })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = yellow })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineInfo", { undercurl = true, sp = blue })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineHint", { undercurl = true, sp = cyan })
-- Diff
vim.api.nvim_set_hl(0, "Added", { fg = green })
vim.api.nvim_set_hl(0, "Removed", { fg = red })
vim.api.nvim_set_hl(0, "Changed", { fg = yellow })
vim.api.nvim_set_hl(0, "DiffAdd", { bg = green_bg })
vim.api.nvim_set_hl(0, "DiffChange", { bg = yellow_bg })
vim.api.nvim_set_hl(0, "DiffDelete", { bg = red_bg })
vim.api.nvim_set_hl(0, "DiffText", { bg = blue_bg })
-- Other Linked
vim.api.nvim_set_hl(0, "Number", { link = "Constant" })
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 = "Operator" })
-- 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 = "DiagnosticInfo" })
vim.api.nvim_set_hl(0, "Question", { link = "DiagnosticInfo" })
vim.api.nvim_set_hl(0, "ErrorMsg", { link = "DiagnosticError" })
vim.api.nvim_set_hl(0, "WarningMsg", { link = "DiagnosticWarn" })
-- UI
vim.api.nvim_set_hl(0, "lCursor", { link = "Cursor" })
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 = "DiagnosticUnderlineError" })
vim.api.nvim_set_hl(0, "SpellCap", { link = "DiagnosticUnderlineWarn" })
vim.api.nvim_set_hl(0, "SpellLocal", { link = "DiagnosticUnderlineWarn" })
vim.api.nvim_set_hl(0, "SpellRare", { link = "DiagnosticUnderlineWarn" })
-- 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" })
-- 128 Lines - 28 Blank Lines & Comments = 100 lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment