Files
nvim-config/colors/lgwtdark.lua
SepehrYahyaee 8b25fb90bf First version
2026-04-13 13:41:22 +03:30

235 lines
8.0 KiB
Lua

-- Learn Go With Tests (dark) - palette from site CSS, dark-mode token colors.
-- Requires: termguicolors. For Go, nvim-treesitter is strongly recommended.
vim.cmd.hi('clear')
vim.g.colors_name = 'lgwtdark'
if vim.fn.exists('syntax_on') == 1 then
vim.cmd.syntax('reset')
end
vim.o.termguicolors = true
vim.o.background = 'dark'
-- Dark-mode values from your spec (second branch of light-dark / --shiki-dark).
local C = {
-- primary-2: code panels on the site read slightly cooler than primary-1; warm text pops closer to the book.
bg = '#202325',
keyword = '#f8a8a1', -- danger-11
string_ = '#9bd0a1', -- success-11
entity = '#a0c6e0', -- primary-11 (packages, types, func/method names & calls)
-- warning-11 nudged warmer (more R, less B) so it matches the orange-gold on the page next to this bg
warm = '#e5b899',
fg = '#feffff', -- tint-12 (variables, brackets, delimiters)
comment = '#787878', -- neutral-9
operator = '#bdc1c3', -- tint-11
-- subtle UI derived from primary scale
cursorline = '#262d32', -- primary-3
visual = '#34495a', -- between primary-4 / 5
linenr = '#525252', -- neutral-7
float_bg = '#222222',
}
local function hi(name, opts)
vim.api.nvim_set_hl(0, name, opts)
end
-- Editor chrome
hi('Normal', { fg = C.fg, bg = C.bg })
hi('NormalNC', { fg = C.fg, bg = C.bg })
hi('NormalFloat', { fg = C.fg, bg = C.float_bg })
hi('Cursor', { fg = C.bg, bg = C.entity })
hi('lCursor', { link = 'Cursor' })
hi('CursorLine', { bg = C.cursorline })
hi('CursorColumn', { bg = C.cursorline })
hi('LineNr', { fg = C.linenr, bg = C.bg })
hi('CursorLineNr', { fg = C.warm, bg = C.cursorline })
hi('SignColumn', { bg = C.bg })
hi('Folded', { fg = C.comment, bg = '#242424' })
hi('FoldColumn', { fg = C.comment, bg = C.bg })
hi('Whitespace', { fg = '#333333' })
hi('WinSeparator', { fg = '#2a2a2a', bg = C.bg })
hi('EndOfBuffer', { fg = C.bg, bg = C.bg })
hi('Search', { fg = C.bg, bg = C.warm })
hi('IncSearch', { fg = C.bg, bg = C.keyword })
hi('Visual', { bg = C.visual })
hi('VisualNOS', { bg = C.visual })
hi('StatusLine', { fg = C.fg, bg = '#333333' })
hi('StatusLineNC', { fg = C.comment, bg = '#252525' })
hi('TabLine', { fg = C.comment, bg = '#252525' })
hi('TabLineFill', { bg = C.bg })
hi('TabLineSel', { fg = C.entity, bg = '#333333' })
hi('Error', { fg = '#fb2c36', bold = true })
hi('WarningMsg', { fg = '#fe9a00' })
hi('MatchParen', { fg = C.keyword, bg = '#3a3a3a', bold = true })
hi('Pmenu', { fg = C.fg, bg = '#2d2d2d' })
hi('PmenuSel', { fg = C.bg, bg = C.entity })
hi('PmenuSbar', { bg = '#444444' })
hi('PmenuThumb', { bg = '#666666' })
hi('Title', { fg = C.entity, bold = true })
hi('Directory', { fg = C.entity })
-- Builtin highlight groups (legacy syntax / fallbacks)
hi('Comment', { fg = C.comment })
hi('String', { fg = C.string_ })
hi('Character', { fg = C.string_ })
hi('Number', { fg = C.warm })
hi('Float', { fg = C.warm })
hi('Boolean', { fg = C.warm })
hi('Constant', { fg = C.warm })
hi('Identifier', { fg = C.fg })
hi('Function', { fg = C.entity })
hi('Statement', { fg = C.keyword })
hi('Conditional', { fg = C.keyword })
hi('Repeat', { fg = C.keyword })
hi('Label', { fg = C.keyword })
hi('Operator', { fg = C.operator })
hi('Keyword', { fg = C.keyword })
hi('Exception', { fg = C.keyword })
hi('PreProc', { fg = C.keyword })
hi('Include', { fg = C.keyword })
hi('Define', { fg = C.keyword })
hi('Macro', { fg = C.entity })
hi('Type', { fg = C.entity })
hi('StorageClass', { fg = C.keyword })
hi('Structure', { fg = C.keyword })
hi('Special', { fg = C.warm })
hi('SpecialChar', { fg = C.warm })
hi('Delimiter', { fg = C.fg })
hi('Underlined', { fg = C.entity, underline = true })
hi('Ignore', { fg = C.bg })
hi('Todo', { fg = C.warm, bold = true })
-- Treesitter (Go and general)
local ts = {
['@comment'] = { fg = C.comment },
['@comment.documentation'] = { fg = C.comment },
['@keyword'] = { fg = C.keyword },
['@keyword.function'] = { fg = C.keyword },
['@keyword.operator'] = { fg = C.keyword },
['@keyword.return'] = { fg = C.keyword },
['@keyword.import'] = { fg = C.keyword },
['@keyword.exception'] = { fg = C.keyword },
['@keyword.coroutine'] = { fg = C.keyword },
['@keyword.directive'] = { fg = C.keyword },
['@keyword.directive.define'] = { fg = C.keyword },
['@type.builtin'] = { fg = C.keyword },
['@string'] = { fg = C.string_ },
['@string.documentation'] = { fg = C.string_ },
['@string.regex'] = { fg = C.string_ },
['@string.escape'] = { fg = C.warm },
['@string.special'] = { fg = C.warm },
['@string.special.url'] = { fg = C.entity, underline = true },
['@character'] = { fg = C.string_ },
['@character.special'] = { fg = C.warm },
['@number'] = { fg = C.warm },
['@float'] = { fg = C.warm },
['@boolean'] = { fg = C.warm },
['@function'] = { fg = C.entity },
['@function.call'] = { fg = C.entity },
['@function.builtin'] = { fg = C.entity },
['@function.macro'] = { fg = C.entity },
['@method'] = { fg = C.entity },
['@method.call'] = { fg = C.entity },
['@constructor'] = { fg = C.entity },
['@type'] = { fg = C.entity },
['@type.definition'] = { fg = C.entity },
['@namespace'] = { fg = C.entity },
['@module'] = { fg = C.entity },
['@variable'] = { fg = C.fg },
['@variable.builtin'] = { fg = C.keyword },
['@variable.parameter'] = { fg = C.warm },
['@variable.member'] = { fg = C.fg },
['@parameter'] = { fg = C.warm },
['@constant'] = { fg = C.warm },
['@constant.builtin'] = { fg = C.keyword },
['@constant.macro'] = { fg = C.entity },
['@property'] = { fg = C.fg },
['@field'] = { fg = C.fg },
['@operator'] = { fg = C.operator },
['@punctuation.delimiter'] = { fg = C.fg },
['@punctuation.bracket'] = { fg = C.fg },
['@punctuation.special'] = { fg = C.fg },
['@label'] = { fg = C.warm },
['@exception'] = { fg = C.keyword },
['@include'] = { fg = C.keyword },
['@repeat'] = { fg = C.keyword },
['@conditional'] = { fg = C.keyword },
['@tag'] = { fg = C.entity },
['@tag.attribute'] = { fg = C.warm },
['@tag.delimiter'] = { fg = C.fg },
['@markup.link'] = { fg = C.entity, underline = true },
['@markup.link.url'] = { fg = C.entity, underline = true },
['@markup.strong'] = { bold = true },
['@markup.italic'] = { italic = true },
}
for g, o in pairs(ts) do
hi(g, o)
end
-- Diagnostics (readable on this bg)
hi('DiagnosticError', { fg = '#fb2c36' })
hi('DiagnosticWarn', { fg = '#fe9a00' })
hi('DiagnosticInfo', { fg = C.entity })
hi('DiagnosticHint', { fg = C.comment })
hi('DiagnosticUnderlineError', { sp = '#fb2c36', undercurl = true })
hi('DiagnosticUnderlineWarn', { sp = '#fe9a00', undercurl = true })
hi('DiagnosticUnderlineInfo', { sp = C.entity, undercurl = true })
hi('DiagnosticUnderlineHint', { sp = C.comment, undercurl = true })
-- LSP semantic tokens → same story as Treesitter where possible
hi('@lsp.type.namespace', { link = '@module' })
hi('@lsp.type.type', { link = '@type' })
hi('@lsp.type.class', { link = '@type' })
hi('@lsp.type.enum', { link = '@type' })
hi('@lsp.type.interface', { link = '@type' })
hi('@lsp.type.struct', { link = '@type' })
hi('@lsp.type.typeParameter', { link = '@type' })
hi('@lsp.type.function', { link = '@function' })
hi('@lsp.type.method', { link = '@method' })
hi('@lsp.type.property', { link = '@property' })
hi('@lsp.type.variable', { link = '@variable' })
hi('@lsp.type.parameter', { link = '@parameter' })
hi('@lsp.type.enumMember', { link = '@constant' })
hi('@lsp.type.decorator', { link = '@function.macro' })
hi('@lsp.type.macro', { link = '@function.macro' })
hi('@lsp.type.keyword', { link = '@keyword' })
hi('@lsp.type.operator', { link = '@operator' })
hi('@lsp.type.string', { link = '@string' })
hi('@lsp.type.number', { link = '@number' })
hi('@lsp.type.regexp', { link = '@string.regex' })
hi('@lsp.mod.readonly', { link = '@constant' })
hi('@lsp.mod.defaultLibrary', { link = '@type.builtin' })
-- Extmarks from lua/lgwtdark/go_extra.lua (fmt verbs, rune delimiters)
hi('LgwtdFmtVerb', { fg = C.warm })
hi('LgwtdQuote', { fg = C.fg })
hi('LgwtdStrInner', { fg = C.string_ })
hi('LgwtdEscape', { fg = C.warm })
hi('LgwtdNil', { link = '@number' })