-- nvim/.config/nvim/lua/colorscheme.lua
-- Default to kanagawa for warmth, fall back to the built-in "habamax"
-- theme on a box without plugins so the editor is still readable.
vim.opt.termguicolors = true
vim.opt.background = "dark"
-- If I am over SSH on a dumb terminal, skip truecolor to avoid broken
-- colour pairs that upset tmux panes.
if vim.env.COLORTERM ~= "truecolor" and vim.env.COLORTERM ~= "24bit" then
vim.opt.termguicolors = false
end
local ok, kanagawa = pcall(require, "kanagawa")
if ok then
kanagawa.setup({
compile = true,
undercurl = true,
commentStyle = { italic = true },
functionStyle = { bold = false },
keywordStyle = { italic = true },
statementStyle = { bold = false },
transparent = false,
dimInactive = true,
terminalColors = true,
theme = "wave",
background = { dark = "wave", light = "lotus" },
colors = {
theme = {
all = {
ui = {
bg_gutter = "none",
},
},
},
},
})
vim.cmd.colorscheme("kanagawa")
else
-- Fallback: built-in scheme that never fails to load.
vim.cmd.colorscheme("habamax")
end
-- A few overrides that survive scheme swaps.
local augroup = vim.api.nvim_create_augroup("user_colors", { clear = true })
vim.api.nvim_create_autocmd("ColorScheme", {
group = augroup,
callback = function()
-- Make diagnostics a little less shouty.
vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { undercurl = true, sp = "#e46876" })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { undercurl = true, sp = "#dca561" })
-- Keep the cursor line gutter readable but subtle.
vim.api.nvim_set_hl(0, "CursorLineNr", { bold = true })
end,
})