neovim light theme working 1

This commit is contained in:
Tomas Mirchev 2025-09-26 00:52:00 +00:00
parent 23309c9a12
commit 14eac65897
12 changed files with 371 additions and 270 deletions

View File

@ -5,8 +5,96 @@ vim.api.nvim_create_autocmd("TextYankPost", {
end, end,
}) })
----------------------------------------------
-- Show cursorline only in the active window -- Reload ColorScheme by clearing cached modules
vim.api.nvim_create_user_command("ReloadColorscheme", function()
local current = vim.g.colors_name
if not current then
vim.notify("No colorscheme is currently set", vim.log.levels.WARN)
return
end
-- clear only the cached modules for this theme
for k in pairs(package.loaded) do
if k:match("^themes%." .. current) then
package.loaded[k] = nil
end
end
-- reload it
vim.cmd("colorscheme " .. current)
vim.notify("Reloaded " .. current .. " colorscheme", vim.log.levels.INFO)
end, { desc = "Reload the current colorscheme" })
----------------------------------------------
-- Command `:TSHighlightRoots` (works but uncomment only when used)
-- Description:
-- Collects all Tree-sitter highlight groups, resolves their links,
-- and outputs the unique root groups actually used (for theming/debugging).
--
-- Usage:
-- :TSHighlightRoots → prints roots in the command line
-- :TSHighlightRoots <filename> → writes roots into <filename> (overwrites)
-- (filename supports `~` and tab-completion)
--
-- local function resolve_link(name)
-- local seen = {}
-- while name and not seen[name] do
-- seen[name] = true
-- local hl = vim.api.nvim_get_hl(0, { name = name })
-- if hl.link then
-- name = hl.link
-- else
-- return name
-- end
-- end
-- end
--
-- vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
-- vim.api.nvim_create_user_command("TSHighlightRoots", function(opts)
-- local roots = {}
-- for _, group in ipairs(vim.fn.getcompletion("@", "highlight")) do
-- local root = resolve_link(group)
-- if root then
-- roots[root] = true
-- end
-- end
--
-- local output = { "Unique root highlight groups used by Tree-sitter:" }
-- for root in pairs(roots) do
-- table.insert(output, " " .. root)
-- end
--
-- if opts.args ~= "" then
-- -- write to file
-- local filename = vim.fn.expand(opts.args)
-- local fd = assert(io.open(filename, "w"))
-- fd:write(table.concat(output, "\n"))
-- fd:close()
-- print("Wrote roots to " .. filename)
-- else
-- -- default: print to command line
-- for _, line in ipairs(output) do
-- print(line)
-- end
-- end
-- end, {
-- nargs = "?", -- allow 0 or 1 argument
-- complete = "file", -- tab-complete filenames
-- })
-- end,
-- })
----------------------------------------------
----------------------------------------------
-- Useful tricks that do not fully work
----------------------------------------------
-- -- Show cursorline only in the active window
--
-- vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, { -- vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, {
-- callback = function() -- callback = function()
-- local ft = vim.bo.filetype -- local ft = vim.bo.filetype
@ -16,7 +104,7 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- -- end -- -- end
-- end, -- end,
-- }) -- })
--
-- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, { -- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, {
-- callback = function() -- callback = function()
-- local ft = vim.bo.filetype -- local ft = vim.bo.filetype
@ -27,15 +115,13 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- end, -- end,
-- }) -- })
-- Reload Invero colorscheme without restarting Neovim ----------------------------------------------
vim.api.nvim_create_user_command("ReloadInvero", function()
-- clear the cached modules so require() reloads them
for k in pairs(package.loaded) do
if k:match("^themes%.invero") then
package.loaded[k] = nil
end
end
-- reload the colorscheme -- -- Associate filetype
vim.cmd("colorscheme invero") --
end, { desc = "Reload the Invero theme" }) -- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "text",
-- callback = function()
-- vim.bo.filetype = "markdown"
-- end,
-- })

View File

@ -1,136 +1,137 @@
return { return {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
version = "*", version = "*",
lazy = false, lazy = false,
keys = { keys = {
{ "<Leader>et", ":NvimTreeToggle<CR>", desc = "Explorer Toggle", silent = true }, { "<Leader>et", ":NvimTreeToggle<CR>", desc = "Explorer Toggle", silent = true },
}, },
config = function() config = function()
require("nvim-tree").setup { require("nvim-tree").setup({
hijack_cursor = true, hijack_cursor = true,
disable_netrw = true, disable_netrw = true,
hijack_netrw = true, hijack_netrw = true,
hijack_unnamed_buffer_when_opening = true, hijack_unnamed_buffer_when_opening = true,
root_dirs = { ".git", "package.json" }, root_dirs = { ".git", "package.json" },
prefer_startup_root = true, prefer_startup_root = true,
sync_root_with_cwd = true, sync_root_with_cwd = true,
reload_on_bufenter = true, reload_on_bufenter = true,
respect_buf_cwd = true, respect_buf_cwd = true,
view = { view = {
centralize_selection = false, centralize_selection = false,
cursorline = true, cursorline = true,
cursorlineopt = "both", cursorlineopt = "both",
debounce_delay = 15, debounce_delay = 15,
side = "left", side = "left",
preserve_window_proportions = false, preserve_window_proportions = false,
number = false, number = false,
relativenumber = false, relativenumber = false,
signcolumn = "no", signcolumn = "no",
width = 30, width = 30,
}, },
renderer = { renderer = {
add_trailing = false, add_trailing = false,
group_empty = false, group_empty = false,
full_name = false, full_name = false,
root_folder_label = false, root_folder_label = false,
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" }, -- special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
symlink_destination = true, special_files = {}, -- keep to overwrite defaults
icons = { symlink_destination = true,
padding = "", icons = {
glyphs = { padding = "",
folder = { glyphs = {
arrow_closed = "+", folder = {
arrow_open = "-", arrow_closed = "+",
}, arrow_open = "-",
}, },
show = { },
file = false, show = {
folder = false, file = false,
folder_arrow = true, folder = false,
git = false, folder_arrow = true,
modified = false, git = false,
hidden = false, modified = false,
diagnostics = false, hidden = false,
bookmarks = false, diagnostics = false,
}, bookmarks = false,
} },
}, },
hijack_directories = { },
enable = true, hijack_directories = {
auto_open = true, enable = true,
}, auto_open = true,
update_focused_file = { },
enable = true, update_focused_file = {
update_root = { enable = true,
enable = true, update_root = {
ignore_list = {}, enable = true,
}, ignore_list = {},
exclude = false, },
}, exclude = false,
filters = { },
enable = true, filters = {
git_ignored = true, enable = true,
dotfiles = false, git_ignored = true,
git_clean = false, dotfiles = false,
no_buffer = false, git_clean = false,
no_bookmark = false, no_buffer = false,
custom = {}, no_bookmark = false,
exclude = {}, custom = {},
}, exclude = {},
live_filter = { },
prefix = "[FILTER]: ", live_filter = {
always_show_folders = true, prefix = "[FILTER]: ",
}, always_show_folders = true,
filesystem_watchers = { },
enable = true, filesystem_watchers = {
debounce_delay = 50, enable = true,
ignore_dirs = { debounce_delay = 50,
-- C / C++ ignore_dirs = {
"/.ccls-cache", -- C / C++
"/build", "/.ccls-cache",
"/out", "/build",
"/cmake-build-*", "/out",
"/cmake-build-*",
-- Node.js / Web -- Node.js / Web
"/node_modules", "/node_modules",
"/dist", "/dist",
"/.next", "/.next",
"/.nuxt", "/.nuxt",
"/coverage", "/coverage",
"/storybook-static", "/storybook-static",
-- Rust -- Rust
"/target", "/target",
-- Java / JVM -- Java / JVM
"/target", -- (Maven) "/target", -- (Maven)
"/build", -- (Gradle) "/build", -- (Gradle)
"/out", -- (IDEA / javac) "/out", -- (IDEA / javac)
-- Python -- Python
"/.venv", "/.venv",
"/venv", "/venv",
"/__pycache__", "/__pycache__",
"/.mypy_cache", "/.mypy_cache",
"/.pytest_cache", "/.pytest_cache",
-- Go -- Go
"/bin", "/bin",
"/pkg", "/pkg",
-- General -- General
"/tmp", "/tmp",
"/.cache", "/.cache",
"/.idea", "/.idea",
"/.vscode", "/.vscode",
"/logs", "/logs",
} },
}, },
trash = { trash = {
cmd = "gio trash", cmd = "gio trash",
}, },
} })
end, end,
} }
-- return { -- return {

View File

@ -1,34 +1,32 @@
return { return {
'nvim-treesitter/nvim-treesitter', "nvim-treesitter/nvim-treesitter",
build = 'TSUpdate', build = "TSUpdate",
main = 'nvim-treesitter.configs', main = "nvim-treesitter.configs",
opts = { opts = {
ensure_installed = { ensure_installed = {
'diff', "diff",
'lua', "lua",
'html', "html",
'css', "css",
'javascript', "javascript",
'typescript', "typescript",
'tsx', "tsx",
'markdown', "markdown",
'markdown_inline' "markdown_inline",
}, },
auto_install = true, auto_install = true,
highlight = { highlight = {
enable = true, enable = true,
}, },
indent = { enable = true } indent = { enable = true },
}, },
config = function(_, opts) config = function(_, opts)
require('nvim-treesitter.configs').setup(opts) require("nvim-treesitter.configs").setup(opts)
-- Add MDX filetype detection -- Add MDX filetype detection
vim.filetype.add({ vim.filetype.add({
extension = { extension = {
mdx = 'markdown.mdx', mdx = "markdown.mdx",
}, },
}) })
end, end,
} }

View File

@ -1,19 +1,18 @@
local M = {} local M = {}
function M.get(P) function M.get(P)
local colors = { local colors = {
base = P.white, base = P.white,
surface = P.gray_light, surface = P.gray_light,
text = P.black, text = P.black,
muted = P.gray, muted = P.gray,
accent = P.blue, accent = P.blue,
accent_light = P.blue_light, accent_light = P.blue_light,
syntax = 60, syntax = P.slate_indigo,
none = "NONE", none = "NONE",
} }
return vim.tbl_extend("force", P, colors) return vim.tbl_extend("force", P, colors)
end end
return M return M

View File

@ -3,16 +3,18 @@ local M = {}
function M.get(C) function M.get(C)
return { return {
Normal = { fg = C.text, bg = C.none }, Normal = { fg = C.text, bg = C.none },
Directory = { fg = C.accent },
Question = { fg = C.text },
LineNr = { fg = C.muted }, LineNr = { fg = C.muted },
CursorLineNr = { fg = C.accent, bold = true }, CursorLineNr = { fg = C.accent, bold = true },
CursorLine = { bg = C.surface }, CursorLine = { bg = C.surface },
Visual = { bg = C.accent_light }, Visual = { bg = C.accent_light },
Search = { fg = C.yellow }, Search = { fg = C.yellow },
CurSearch = { fg = C.base, bg = C.yellow, bold = true }, CurSearch = { fg = C.yellow, bg = C.none, bold = true },
IncSearch = { fg = C.base, bg = C.yellow, bold = true }, IncSearch = { fg = C.yellow, bg = C.none, bold = true },
MatchParen = { fg = C.base, bg = C.accent }, MatchParen = { fg = C.accent, bg = C.accent_light, bold = true },
EndOfBuffer = { fg = C.base }, -- End-of-buffer marker (~ lines) EndOfBuffer = { fg = C.base }, -- End-of-buffer marker (~ lines)
WinSeparator = { fg = C.muted }, WinSeparator = { fg = C.muted },
@ -24,13 +26,6 @@ function M.get(C)
TabLine = { fg = C.muted }, -- Unselected tab TabLine = { fg = C.muted }, -- Unselected tab
TabLineSel = { fg = C.text, bold = true }, -- Selected tab TabLineSel = { fg = C.text, bold = true }, -- Selected tab
TabLineFill = { bg = C.none }, -- Empty space in the tabline TabLineFill = { bg = C.none }, -- Empty space in the tabline
-- DiagnosticError = { undercurl = true, sp = C.red },
-- DiagnosticWarn = { undercurl = true, sp = C.yellow },
-- DiagnosticInfo = { underline = true, sp = C.accent },
-- DiagnosticHint = { underline = true, sp = C.green },
Directory = { fg = C.accent },
} }
end end

View File

@ -1,13 +1,7 @@
local M = {} local M = {}
function M.get(C) function M.get(C)
return { return {}
NvimTreeFolderIcon = { fg = C.accent },
NvimTreeRootFolder = { fg = C.text, bold = true },
-- NvimTreeOpenedHL = { bg = C.surface },
}
end end
return M return M

View File

@ -2,10 +2,7 @@ local M = {}
function M.get(C) function M.get(C)
return { return {
-- TelescopeBorder = { fg = C.muted, bg = C.green }, TelescopeMatching = { fg = C.yellow, bg = C.none, bold = true },
TelescopePrompt = { fg = C.text, bg = C.green },
-- TelescopePromptPrefix = { fg = C.accent, bg = C.red },
-- TelescopeSelection = { bg = C.surface },
} }
end end

View File

@ -1,24 +1,20 @@
local M = {} local M = {}
function M.get(C) function M.get(C)
local theme = { return {
["@comment"] = { fg = C.muted, italic = true }, ["@constant.macro"] = { fg = C.syntax },
["@spell"] = { fg = C.syntax }, ["@function.method"] = { fg = C.syntax },
["@markup"] = { fg = C.syntax }, ["@type.qualifier"] = { fg = C.syntax },
["@text"] = { fg = C.syntax }, ["@variable.parameter"] = { fg = C.syntax },
["@property"] = { fg = C.syntax }, ["@variable"] = { fg = C.syntax },
["@conceal"] = { fg = C.syntax }, ["@type.definition"] = { fg = C.syntax },
} ["@markup.italic"] = { fg = C.syntax },
["@markup.strong"] = { fg = C.syntax },
["@markup.underline"] = { fg = C.syntax },
["@markup.strikethrough"] = { fg = C.syntax },
for _, hl in ipairs(vim.fn.getcompletion("@", "highlight")) do ["@_jsx_attribute"] = { link = "Constant" },
if theme[hl] == nil then }
theme[hl] = { fg = C.syntax }
end
end
return theme
end end
return M return M

View File

@ -1,9 +1,36 @@
local M = {} local M = {}
-- fallback for vim without tree-sitter
function M.get(C) function M.get(C)
return {} return {
Comment = { fg = C.muted, italic = true },
-- general
Constant = { fg = C.syntax },
String = { fg = C.syntax },
Function = { fg = C.syntax },
Type = { fg = C.syntax },
Statement = { fg = C.syntax },
Identifier = { fg = C.syntax },
Operator = { fg = C.syntax },
PreProc = { fg = C.syntax },
Special = { fg = C.syntax },
Delimiter = { fg = C.syntax },
Todo = { fg = C.syntax },
Title = { fg = C.syntax },
Underlined = { fg = C.syntax },
-- diffs
Added = { fg = C.green },
Removed = { fg = C.red },
Changed = { fg = C.yellow },
-- diagnostics
DiagnosticInfo = { fg = C.blue },
DiagnosticWarn = { fg = C.yellow },
DiagnosticError = { fg = C.red },
DiagnosticDeprecated = { fg = C.magenta },
DiagnosticUnderlineError = { fg = C.syntax, underline = true },
}
end end
return M return M

View File

@ -1,12 +1,14 @@
local M = { local M = {
name = "invero", name = "invero",
variant = "light", variant = "light",
mode = "ansi",
exclude_integrations = {},
} }
function M.load() function M.load()
local setup = require("themes." .. M.name .. ".setup") local setup = require("themes." .. M.name .. ".setup")
setup.reset(M) setup.reset(M)
setup.apply(M) setup.apply(M)
end end
return M return M

View File

@ -1,37 +1,52 @@
local M = {} local M = {}
function M.get() local modes = {
return { ansi = {
black = 0, black = 0,
gray = 247, red = 1,
gray_light = 253, green = 2,
red = 1, yellow = 3,
green = 2, blue = 4,
yellow = 3, magenta = 5,
yellow_light = 180, cyan = 6,
blue = 4, white = 7,
blue_light = 153, },
magenta = 5, default = {
cyan = 6, black = 238,
white = 7, red = 196,
} green = 35,
yellow = 221,
blue = 27,
magenta = 125,
cyan = 30,
white = 255,
},
}
-- return { local shared_palette = {
-- black = 238, gray = 247,
-- gray = 247, gray_light = 253,
-- gray_light = 253, orange = 166,
-- red = 196, orange_light = 180,
-- green = 35, yellow_light = 180,
-- yellow = 221, blue_light = 153,
-- orange = 166, slate_indigo = 60,
-- orange_light = 180, }
-- blue = 27,
-- blue_light = 153, ---Get color palette
-- magenta = 125, ---@param mode '"ansi"'|'"default"'
-- cyan = 30, ---@return table
-- white = 255, function M.get(mode)
-- } local mode_palette = modes[mode]
if not mode_palette then
vim.notify(
string.format('Invalid palette mode: "%s" (valid: ansi, default)', tostring(mode)),
vim.log.levels.WARN,
{ title = "palette" }
)
mode_palette = modes.default
end
return vim.tbl_extend("force", mode_palette, shared_palette)
end end
return M return M

View File

@ -20,7 +20,7 @@ end
function M.apply(theme) function M.apply(theme)
local base = "themes." .. theme.name local base = "themes." .. theme.name
local P = require(base .. ".palette").get() local P = require(base .. ".palette").get(theme.mode)
local C = require(base .. ".colors").get(P) local C = require(base .. ".colors").get(P)
local modules = { local modules = {
@ -54,19 +54,10 @@ function M.apply(theme)
end end
local hl = {} local hl = {}
-- ALT: Use both scenarios
-- if type(v) == "number" then
-- hl.ctermfg = v
-- else
-- hl.fg = v
-- end
for k, v in pairs(opts) do for k, v in pairs(opts) do
if k == "fg" then if k == "fg" then
hl.fg = v
hl.ctermfg = v hl.ctermfg = v
elseif k == "bg" then elseif k == "bg" then
hl.bg = v
hl.ctermbg = v hl.ctermbg = v
else else
hl[k] = v -- bold, italic, underline, sp, etc. hl[k] = v -- bold, italic, underline, sp, etc.