neovim custom invero light-theme #1

Merged
tomas.mirchev merged 15 commits from light-theme into main 2025-09-26 03:06:13 +00:00
12 changed files with 371 additions and 270 deletions
Showing only changes of commit 14eac65897 - Show all commits

View File

@ -5,8 +5,96 @@ vim.api.nvim_create_autocmd("TextYankPost", {
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" }, {
-- callback = function()
-- local ft = vim.bo.filetype
@ -16,7 +104,7 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- -- end
-- end,
-- })
--
-- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, {
-- callback = function()
-- local ft = vim.bo.filetype
@ -27,15 +115,13 @@ vim.api.nvim_create_autocmd("TextYankPost", {
-- 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
vim.cmd("colorscheme invero")
end, { desc = "Reload the Invero theme" })
-- -- Associate filetype
--
-- vim.api.nvim_create_autocmd("FileType", {
-- pattern = "text",
-- callback = function()
-- vim.bo.filetype = "markdown"
-- end,
-- })

View File

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

View File

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

View File

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

View File

@ -3,16 +3,18 @@ local M = {}
function M.get(C)
return {
Normal = { fg = C.text, bg = C.none },
Directory = { fg = C.accent },
Question = { fg = C.text },
LineNr = { fg = C.muted },
CursorLineNr = { fg = C.accent, bold = true },
CursorLine = { bg = C.surface },
Visual = { bg = C.accent_light },
Search = { fg = C.yellow },
CurSearch = { fg = C.base, bg = C.yellow, bold = true },
IncSearch = { fg = C.base, bg = C.yellow, bold = true },
CurSearch = { fg = C.yellow, bg = C.none, 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)
WinSeparator = { fg = C.muted },
@ -24,13 +26,6 @@ function M.get(C)
TabLine = { fg = C.muted }, -- Unselected tab
TabLineSel = { fg = C.text, bold = true }, -- Selected tab
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

View File

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

View File

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

View File

@ -1,24 +1,20 @@
local M = {}
function M.get(C)
local theme = {
["@comment"] = { fg = C.muted, italic = true },
["@spell"] = { fg = C.syntax },
["@markup"] = { fg = C.syntax },
["@text"] = { fg = C.syntax },
["@property"] = { fg = C.syntax },
["@conceal"] = { fg = C.syntax },
}
return {
["@constant.macro"] = { fg = C.syntax },
["@function.method"] = { fg = C.syntax },
["@type.qualifier"] = { fg = C.syntax },
["@variable.parameter"] = { fg = C.syntax },
["@variable"] = { 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
if theme[hl] == nil then
theme[hl] = { fg = C.syntax }
end
end
return theme
["@_jsx_attribute"] = { link = "Constant" },
}
end
return M

View File

@ -1,9 +1,36 @@
local M = {}
-- fallback for vim without tree-sitter
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
return M

View File

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

View File

@ -1,37 +1,52 @@
local M = {}
function M.get()
return {
black = 0,
gray = 247,
gray_light = 253,
red = 1,
green = 2,
yellow = 3,
yellow_light = 180,
blue = 4,
blue_light = 153,
magenta = 5,
cyan = 6,
white = 7,
}
local modes = {
ansi = {
black = 0,
red = 1,
green = 2,
yellow = 3,
blue = 4,
magenta = 5,
cyan = 6,
white = 7,
},
default = {
black = 238,
red = 196,
green = 35,
yellow = 221,
blue = 27,
magenta = 125,
cyan = 30,
white = 255,
},
}
-- return {
-- black = 238,
-- gray = 247,
-- gray_light = 253,
-- red = 196,
-- green = 35,
-- yellow = 221,
-- orange = 166,
-- orange_light = 180,
-- blue = 27,
-- blue_light = 153,
-- magenta = 125,
-- cyan = 30,
-- white = 255,
-- }
local shared_palette = {
gray = 247,
gray_light = 253,
orange = 166,
orange_light = 180,
yellow_light = 180,
blue_light = 153,
slate_indigo = 60,
}
---Get color palette
---@param mode '"ansi"'|'"default"'
---@return table
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
return M

View File

@ -20,7 +20,7 @@ end
function M.apply(theme)
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 modules = {
@ -54,19 +54,10 @@ function M.apply(theme)
end
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
if k == "fg" then
hl.fg = v
hl.ctermfg = v
elseif k == "bg" then
hl.bg = v
hl.ctermbg = v
else
hl[k] = v -- bold, italic, underline, sp, etc.