neovim custom invero light-theme (#1)
Reviewed-on: #1 Co-authored-by: Tomas Mirchev <contact@tomastm.com> Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit is contained in:
19
config/linux-dev/nvim/lua/themes/invero/colors.lua
Normal file
19
config/linux-dev/nvim/lua/themes/invero/colors.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(P)
|
||||
local colors = {
|
||||
base = P.white,
|
||||
surface = P.gray_light,
|
||||
outline = P.gray_dark,
|
||||
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)
|
||||
end
|
||||
|
||||
return M
|
||||
32
config/linux-dev/nvim/lua/themes/invero/groups/editor.lua
Normal file
32
config/linux-dev/nvim/lua/themes/invero/groups/editor.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
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.yellow, bg = C.none, bold = true },
|
||||
IncSearch = { fg = C.yellow, bg = C.none, bold = true },
|
||||
|
||||
MatchParen = { fg = C.accent, bg = C.accent_light, bold = true },
|
||||
EndOfBuffer = { fg = C.base }, -- End-of-buffer marker (~ lines)
|
||||
|
||||
WinSeparator = { fg = C.outline },
|
||||
StatusLine = { fg = C.outline, bg = C.none }, -- Active statusline (where filename)
|
||||
MsgArea = { fg = C.text, bg = C.none }, -- Command-line / message area
|
||||
MsgSeparator = { fg = C.text, bg = C.surface }, -- Separator for messages
|
||||
ModeMsg = { fg = C.text },
|
||||
|
||||
TabLine = { fg = C.muted }, -- Unselected tab
|
||||
TabLineSel = { fg = C.text, bold = true }, -- Selected tab
|
||||
TabLineFill = { bg = C.none }, -- Empty space in the tabline
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,7 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(C)
|
||||
return {}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,9 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(C)
|
||||
return {
|
||||
TelescopeMatching = { fg = C.yellow, bg = C.none, bold = true },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,20 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(C)
|
||||
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 },
|
||||
|
||||
["@_jsx_attribute"] = { link = "Constant" },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
38
config/linux-dev/nvim/lua/themes/invero/groups/syntax.lua
Normal file
38
config/linux-dev/nvim/lua/themes/invero/groups/syntax.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(C)
|
||||
return {
|
||||
Comment = { fg = C.muted, italic = true },
|
||||
String = { fg = C.green },
|
||||
Boolean = { fg = C.accent, bold = true, italic = true },
|
||||
Number = { fg = C.accent },
|
||||
|
||||
-- syntax color
|
||||
Constant = { 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
|
||||
31
config/linux-dev/nvim/lua/themes/invero/groups/terminal.lua
Normal file
31
config/linux-dev/nvim/lua/themes/invero/groups/terminal.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
local M = {}
|
||||
|
||||
function M.get(C)
|
||||
return {
|
||||
terminal_color_0 = { fg = C.black },
|
||||
terminal_color_8 = { fg = C.black },
|
||||
|
||||
terminal_color_1 = { fg = C.red },
|
||||
terminal_color_9 = { fg = C.red },
|
||||
|
||||
terminal_color_2 = { fg = C.green },
|
||||
terminal_color_10 = { fg = C.green },
|
||||
|
||||
terminal_color_3 = { fg = C.yellow },
|
||||
terminal_color_11 = { fg = C.yellow },
|
||||
|
||||
terminal_color_4 = { fg = C.blue },
|
||||
terminal_color_12 = { fg = C.blue },
|
||||
|
||||
terminal_color_5 = { fg = C.magenta },
|
||||
terminal_color_13 = { fg = C.magenta },
|
||||
|
||||
terminal_color_6 = { fg = C.cyan },
|
||||
terminal_color_14 = { fg = C.cyan },
|
||||
|
||||
terminal_color_7 = { fg = C.white },
|
||||
terminal_color_15 = { fg = C.white },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
14
config/linux-dev/nvim/lua/themes/invero/init.lua
Normal file
14
config/linux-dev/nvim/lua/themes/invero/init.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local M = {
|
||||
name = "invero",
|
||||
variant = "light",
|
||||
mode = "ansi",
|
||||
exclude_integrations = {},
|
||||
}
|
||||
|
||||
function M.load()
|
||||
local setup = require("themes." .. M.name .. ".setup")
|
||||
setup.reset(M)
|
||||
setup.apply(M)
|
||||
end
|
||||
|
||||
return M
|
||||
53
config/linux-dev/nvim/lua/themes/invero/palette.lua
Normal file
53
config/linux-dev/nvim/lua/themes/invero/palette.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
local M = {}
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
||||
local shared_palette = {
|
||||
gray_dark = 245,
|
||||
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
|
||||
72
config/linux-dev/nvim/lua/themes/invero/setup.lua
Normal file
72
config/linux-dev/nvim/lua/themes/invero/setup.lua
Normal file
@@ -0,0 +1,72 @@
|
||||
local M = {}
|
||||
|
||||
function M.reset(theme)
|
||||
vim.opt.background = (theme.variant == "light") and "light" or "dark"
|
||||
vim.g.colors_name = theme.name
|
||||
end
|
||||
|
||||
local function list_integrations(theme_name)
|
||||
local path = vim.fn.stdpath("config") .. "/lua/themes/" .. theme_name .. "/groups/integrations/"
|
||||
|
||||
local files = {}
|
||||
for name, type in vim.fs.dir(path) do
|
||||
if type == "file" then
|
||||
local mod_name = vim.fn.fnamemodify(name, ":r")
|
||||
table.insert(files, mod_name)
|
||||
end
|
||||
end
|
||||
return files
|
||||
end
|
||||
|
||||
function M.apply(theme)
|
||||
local base = "themes." .. theme.name
|
||||
local P = require(base .. ".palette").get(theme.mode)
|
||||
local C = require(base .. ".colors").get(P)
|
||||
|
||||
local modules = {
|
||||
require(base .. ".groups.editor"),
|
||||
require(base .. ".groups.syntax"),
|
||||
require(base .. ".groups.terminal"),
|
||||
}
|
||||
|
||||
local exclude = theme.exclude_integrations or {}
|
||||
|
||||
local function should_load(name)
|
||||
return not vim.tbl_contains(exclude, name)
|
||||
end
|
||||
|
||||
-- auto-discover integrations
|
||||
for _, plugin in ipairs(list_integrations(theme.name)) do
|
||||
if should_load(plugin) then
|
||||
local ok_mod, mod = pcall(require, base .. ".groups.integrations." .. plugin)
|
||||
if ok_mod then
|
||||
table.insert(modules, mod)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Apply highlights
|
||||
for _, mod in ipairs(modules) do
|
||||
local groups = mod.get(C) or {}
|
||||
for group, opts in pairs(groups) do
|
||||
if type(opts) ~= "table" then
|
||||
print("Non-table opts detected in group:", group, "value:", vim.inspect(opts))
|
||||
end
|
||||
local hl = {}
|
||||
|
||||
for k, v in pairs(opts) do
|
||||
if k == "fg" then
|
||||
hl.ctermfg = v
|
||||
elseif k == "bg" then
|
||||
hl.ctermbg = v
|
||||
else
|
||||
hl[k] = v -- bold, italic, underline, sp, etc.
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_set_hl(0, group, hl)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user