Refacto palette and theme, added more colors
This commit is contained in:
26
lua/astrobox/config.lua
Normal file
26
lua/astrobox/config.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---@enum Contrast
|
||||||
|
local CONTRASTS = {
|
||||||
|
soft = "soft",
|
||||||
|
medium = "medium",
|
||||||
|
hard = "hard",
|
||||||
|
}
|
||||||
|
|
||||||
|
---@class Config
|
||||||
|
---@field contrast Contrast
|
||||||
|
---@field float_no_borders boolean
|
||||||
|
|
||||||
|
local M = {
|
||||||
|
---@type Config
|
||||||
|
default = {
|
||||||
|
contrast = CONTRASTS.medium,
|
||||||
|
float_no_borders = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
---@param user_cfg Config
|
||||||
|
---@return Config
|
||||||
|
function M.make_config(user_cfg)
|
||||||
|
return user_cfg and vim.tbl_extend("force", M.default, user_cfg) or M.default
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
local utils = require("astrobox.utils")
|
local utils = require("astrobox.utils")
|
||||||
|
|
||||||
return function(palette, config)
|
local M = {}
|
||||||
|
|
||||||
|
--- @param theme Theme
|
||||||
|
--- @param palette Palette
|
||||||
|
--- @param config Config
|
||||||
|
function M.make_highlights(theme, palette, config)
|
||||||
local HL = {}
|
local HL = {}
|
||||||
local function load_mod(mod, mod_name)
|
local function load_mod(mod, mod_name)
|
||||||
local ok, res = pcall(mod, palette, config)
|
local ok, res = pcall(mod, theme, palette, config)
|
||||||
if ok and res then
|
if ok and res then
|
||||||
HL = vim.tbl_extend("error", HL, res)
|
HL = vim.tbl_extend("error", HL, res)
|
||||||
else
|
else
|
||||||
@@ -12,7 +17,7 @@ return function(palette, config)
|
|||||||
end
|
end
|
||||||
utils.visit_astrobox_modules("highlights.modules", load_mod)
|
utils.visit_astrobox_modules("highlights.modules", load_mod)
|
||||||
|
|
||||||
HL = vim.tbl_extend("force", HL, config.overrides)
|
|
||||||
|
|
||||||
return HL
|
return HL
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|||||||
@@ -1,120 +1,96 @@
|
|||||||
return function(palette)
|
---@param theme Theme
|
||||||
|
---@param palette Palette
|
||||||
|
return function(theme, palette)
|
||||||
return {
|
return {
|
||||||
-- Bold = { bold = true },
|
Conceal = theme.conceal,
|
||||||
-- Italic = { italic = true },
|
Directory = theme.files.directory,
|
||||||
Conceal = { fg = palette.other.conceal, bg = palette.other.harder_bg },
|
EndOfBuffer = { link = "Normal" },
|
||||||
Directory = { fg = palette.blue, bg = palette.none },
|
|
||||||
EndOfBuffer = { fg = palette.bg, bg = palette.bg },
|
|
||||||
MatchParen = { fg = palette.none, bg = palette.none, bold = true, underline = true },
|
MatchParen = { fg = palette.none, bg = palette.none, bold = true, underline = true },
|
||||||
NonText = { fg = palette.ui.fg_inactive, bg = palette.none },
|
NonText = { fg = theme.conceal.fg },
|
||||||
Normal = { fg = palette.fg, bg = palette.bg },
|
Normal = theme.normal,
|
||||||
NormalNC = { link = "Normal" },
|
NormalNC = { link = "Normal" },
|
||||||
QuickFixLine = palette.ui.selection,
|
QuickFixLine = theme.selection,
|
||||||
SpecialKey = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
|
SpecialKey = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
|
||||||
Underlined = { fg = palette.aqua, bg = palette.none, underline = true },
|
Underlined = { fg = palette.aqua, bg = palette.none, underline = true },
|
||||||
|
|
||||||
-- Popup
|
-- Popup
|
||||||
|
FloatTitle = theme.popup.title,
|
||||||
FloatTitle = {
|
FloatBorder = theme.popup.border,
|
||||||
fg = palette.ui.float.title,
|
NormalFloat = theme.popup.normal,
|
||||||
bg = palette.ui.bg,
|
Title = theme.popup.title2,
|
||||||
bold = true,
|
|
||||||
},
|
|
||||||
FloatBorder = {
|
|
||||||
fg = palette.ui.float.border,
|
|
||||||
bg = palette.ui.bg,
|
|
||||||
},
|
|
||||||
NormalFloat = {
|
|
||||||
fg = palette.ui.float.text,
|
|
||||||
bg = palette.ui.bg,
|
|
||||||
},
|
|
||||||
Title = {
|
|
||||||
fg = palette.ui.float.title2,
|
|
||||||
bg = palette.bg,
|
|
||||||
bold = true,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Bars
|
-- Bars
|
||||||
|
StatusCommand = { fg = theme.statusbar.normal.bg, bg = palette.yellow },
|
||||||
TabLine = { fg = palette.ui.fg_inactive, bg = palette.ui.bg_inactive },
|
StatusInsert = { fg = theme.statusbar.normal.bg, bg = palette.green },
|
||||||
TabLineFill = { fg = palette.none, bg = palette.ui.bg_inactive },
|
StatusLine = theme.statusbar.normal,
|
||||||
TabLineSel = { fg = palette.ui.fg, bg = palette.ui.bg, bold = true, italic = true },
|
StatusLineNC = theme.statusbar.inactive,
|
||||||
WinBar = { fg = palette.ui.winbar.fg, bg = palette.ui.winbar.bg },
|
StatusNormal = { fg = theme.statusbar.normal.bg, bg = palette.blue },
|
||||||
WinBarNC = {
|
StatusReplace = { fg = theme.statusbar.normal.bg, bg = palette.red },
|
||||||
fg = palette.ui.winbar.fg_inactive,
|
|
||||||
bg = palette.ui.winbar.bg_inactive,
|
|
||||||
},
|
|
||||||
|
|
||||||
StatusCommand = { fg = palette.ui.statusbar.bg, bg = palette.yellow },
|
|
||||||
StatusInsert = { fg = palette.ui.statusbar.bg, bg = palette.green },
|
|
||||||
StatusLine = { fg = palette.ui.statusbar.fg, bg = palette.ui.statusbar.bg },
|
|
||||||
StatusLineNC = { fg = palette.ui.statusbar.fg_inactive, bg = palette.ui.statusbar.bg },
|
|
||||||
StatusNormal = { fg = palette.ui.statusbar.bg, bg = palette.blue },
|
|
||||||
StatusReplace = { fg = palette.ui.statusbar.bg, bg = palette.red },
|
|
||||||
StatusTerminal = { link = "StatusInsert" },
|
StatusTerminal = { link = "StatusInsert" },
|
||||||
StatusVisual = { fg = palette.ui.statusbar.bg, bg = palette.purple },
|
StatusVisual = { fg = theme.statusbar.normal.bg, bg = palette.purple },
|
||||||
|
TabLine = theme.statusbar.normal,
|
||||||
|
TabLineFill = { link = "TabLine" },
|
||||||
|
TabLineSel = vim.tbl_extend("error", theme.statusbar.inactive, { bold = true, italic = true }),
|
||||||
|
WinBar = theme.winbar.normal,
|
||||||
|
WinBarNC = theme.winbar.inactive,
|
||||||
|
|
||||||
-- Cursor
|
-- Cursor
|
||||||
|
|
||||||
Cursor = { fg = palette.fg, bg = palette.bg },
|
Cursor = { link = "Normal" },
|
||||||
CursorColumn = { link = "CursorLine" },
|
CursorColumn = { link = "CursorLine" },
|
||||||
CursorIM = { link = "Cursor" },
|
CursorIM = { link = "Cursor" },
|
||||||
CursorLine = { fg = palette.none, bg = palette.other.bg_active },
|
CursorLine = theme.active,
|
||||||
CursorLineNr = { fg = palette.ui.fg, bg = palette.none },
|
CursorLineNr = { fg = theme.normal.fg },
|
||||||
LineNr = { fg = palette.ui.fg_inactive, bg = palette.none },
|
LineNr = theme.inactive,
|
||||||
lCursor = { link = "Cursor" },
|
lCursor = { link = "Cursor" },
|
||||||
|
|
||||||
-- Columns
|
-- Columns
|
||||||
ColorColumn = { fg = palette.none, bg = palette.other.bg_active },
|
ColorColumn = theme.active,
|
||||||
FoldColumn = { fg = palette.ui.fg_inactive, bg = palette.none },
|
FoldColumn = theme.active,
|
||||||
Folded = { fg = palette.ui.fg_inactive, bg = palette.none },
|
Folded = theme.conceal,
|
||||||
SignColumn = { fg = palette.none, bg = palette.none }, -- TODO Test
|
SignColumn = theme.none,
|
||||||
|
|
||||||
-- Splits
|
-- Splits
|
||||||
|
|
||||||
WinSeparator = {
|
WinSeparator = theme.windows.separator,
|
||||||
fg = palette.ui.win.separator,
|
|
||||||
bg = palette.bg,
|
|
||||||
-- bold = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Diff
|
-- Diff
|
||||||
|
|
||||||
DiffAdd = { fg = palette.none, bg = palette.colored_backgrounds.green },
|
DiffAdd = theme.diff.bg.add,
|
||||||
DiffChange = { fg = palette.none, bg = palette.colored_backgrounds.blue },
|
DiffChange = theme.diff.bg.change,
|
||||||
DiffDelete = { fg = palette.none, bg = palette.colored_backgrounds.red },
|
DiffDelete = theme.diff.bg.del,
|
||||||
DiffText = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
|
DiffText = theme.diff.bg.text,
|
||||||
DiffAdded = { link = "DiffAdd" },
|
DiffAdded = { link = "DiffAdd" },
|
||||||
DiffRemoved = { link = "DiffDelete" },
|
DiffRemoved = { link = "DiffDelete" },
|
||||||
DiffChanged = { link = "DiffText" }, -- TODO Switch to DiffChange?
|
DiffChanged = { link = "DiffText" }, -- TODO Switch to DiffChange?
|
||||||
DiffOldFile = { fg = palette.red, bg = palette.bg },
|
DiffOldFile = theme.diff.normal.del,
|
||||||
DiffNewFile = { fg = palette.green, bg = palette.bg },
|
DiffNewFile = theme.diff.normal.add,
|
||||||
DiffFile = palette.other.error_hl, -- TODO What's this?
|
DiffFile = theme.error, -- TODO What's this?
|
||||||
DiffLine = palette.other.error_hl, -- TODO What's this?
|
DiffLine = theme.error, -- TODO What's this?
|
||||||
DiffIndexLine = palette.other.error_hl, -- TODO What's this?
|
DiffIndexLine = theme.error,
|
||||||
|
|
||||||
-- Cmd
|
-- Cmd
|
||||||
|
|
||||||
ErrorMsg = { fg = palette.red, bg = palette.none },
|
ErrorMsg = theme.msg.error,
|
||||||
WarningMsg = { fg = palette.yellow, bg = palette.none },
|
WarningMsg = theme.msg.warning,
|
||||||
Question = { fg = palette.blue, bg = palette.none },
|
Question = theme.msg.info,
|
||||||
WildMenu = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg },
|
WildMenu = theme.selection,
|
||||||
|
|
||||||
-- PMenu
|
-- PMenu
|
||||||
|
|
||||||
Pmenu = { fg = palette.ui.fg, bg = palette.ui.bg_hard },
|
Pmenu = theme.menu.normal,
|
||||||
PmenuSel = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg },
|
PmenuSel = theme.menu.selection,
|
||||||
PmenuSbar = { fg = palette.none, bg = palette.ui.float.scroll },
|
PmenuSbar = theme.scrollbar,
|
||||||
PmenuThumb = { link = "PmenuSbar" },
|
PmenuThumb = { link = "PmenuSbar" },
|
||||||
|
|
||||||
-- Search
|
-- Search
|
||||||
|
|
||||||
Search = { fg = palette.fg, bg = palette.other.bg_active },
|
Search = theme.backgrounds.blue,
|
||||||
IncSearch = { fg = palette.none, bg = palette.colored_backgrounds.blue },
|
IncSearch = theme.backgrounds.green,
|
||||||
Substitute = { fg = palette.none, bg = palette.colored_backgrounds.yellow },
|
Substitute = theme.backgrounds.yellow,
|
||||||
CurSearch = { link = "IncSearch" },
|
CurSearch = theme.backgrounds.purple,
|
||||||
Visual = { fg = palette.none, bg = palette.other.bg_active },
|
Visual = theme.backgrounds.aqua,
|
||||||
VisualNOS = { fg = palette.other.bg_active, bg = palette.fg }, -- Meh
|
VisualNOS = theme.backgrounds.red,
|
||||||
|
|
||||||
-- Spelling
|
-- Spelling
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
return function(palette)
|
---@param theme Theme
|
||||||
|
return function(theme)
|
||||||
return {
|
return {
|
||||||
GitSignsAdd = { fg = palette.green },
|
GitSignsAdd = theme.diff.normal.add,
|
||||||
GitSignsChange = { fg = palette.yellow },
|
GitSignsChange = theme.diff.normal.text,
|
||||||
GitSignsDelete = { fg = palette.red },
|
GitSignsDelete = theme.diff.normal.del,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
return function(palette)
|
---@param theme Theme
|
||||||
|
---@param palette Palette
|
||||||
|
return function(theme, palette)
|
||||||
return {
|
return {
|
||||||
["@markup"] = { fg = palette.fg },
|
["@markup"] = { fg = palette.fg },
|
||||||
["@markup.checked"] = { fg = palette.green },
|
["@markup.checked"] = { fg = palette.green },
|
||||||
@@ -8,9 +10,9 @@ return function(palette)
|
|||||||
["@markup.emphasis"] = { fg = palette.fg, italic = true },
|
["@markup.emphasis"] = { fg = palette.fg, italic = true },
|
||||||
["@markup.environment"] = { fg = palette.yellow },
|
["@markup.environment"] = { fg = palette.yellow },
|
||||||
["@markup.environment.name"] = { fg = palette.orange },
|
["@markup.environment.name"] = { fg = palette.orange },
|
||||||
["@markup.heading"] = { fg = palette.green, bold = true },
|
["@markup.heading"] = { fg = theme.colors.accent, bold = true },
|
||||||
["@markup.heading.1.markdown"] = { fg = palette.blue, bold = true },
|
["@markup.heading.1.markdown"] = { fg = theme.colors.accent2, bold = true },
|
||||||
["@markup.heading.2.markdown"] = { fg = palette.aqua, bold = true },
|
["@markup.heading.2.markdown"] = { fg = theme.colors.accent3, bold = true },
|
||||||
["@markup.heading.3.markdown"] = { fg = palette.purple, bold = true },
|
["@markup.heading.3.markdown"] = { fg = palette.purple, bold = true },
|
||||||
["@markup.heading.4.markdown"] = { fg = palette.yellow, bold = true },
|
["@markup.heading.4.markdown"] = { fg = palette.yellow, bold = true },
|
||||||
["@markup.link"] = { fg = palette.aqua, bold = true },
|
["@markup.link"] = { fg = palette.aqua, bold = true },
|
||||||
@@ -31,7 +33,7 @@ return function(palette)
|
|||||||
["@markup.todo.warning"] = { link = "@markup.warning" },
|
["@markup.todo.warning"] = { link = "@markup.warning" },
|
||||||
["@markup.unchecked"] = { fg = palette.blue },
|
["@markup.unchecked"] = { fg = palette.blue },
|
||||||
["@markup.underline"] = { link = "Underline" },
|
["@markup.underline"] = { link = "Underline" },
|
||||||
["@markup.warning"] = { fg = palette.yellow },
|
["@markup.warning"] = { fg = theme.colors.warning },
|
||||||
|
|
||||||
-- Deprecated
|
-- Deprecated
|
||||||
["@text"] = { fg = palette.fg },
|
["@text"] = { fg = palette.fg },
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
return function(palette)
|
---@param theme Theme
|
||||||
|
---@param palette Palette
|
||||||
|
return function(theme, palette)
|
||||||
return {
|
return {
|
||||||
NeoTreeDirectoryIcon = { fg = palette.blue },
|
NeoTreeDirectoryIcon = { link = "Directory" },
|
||||||
NeoTreeRootName = { fg = palette.ui.fg, bold = true },
|
NeoTreeRootName = theme.files.root,
|
||||||
NeoTreeFileName = { fg = palette.ui.fg },
|
NeoTreeFileName = theme.files.file,
|
||||||
NeoTreeFileIcon = { fg = palette.ui.fg },
|
NeoTreeFileIcon = { link = "NeoTreeFileName" },
|
||||||
NeoTreeFloatTitle = { link = "FloatTitle" },
|
NeoTreeIndentMarker = theme.inactive,
|
||||||
NeoTreeIndentMarker = { fg = palette.other.conceal },
|
|
||||||
|
|
||||||
NeoTreeGitAdded = { fg = palette.green },
|
NeoTreeGitAdded = theme.diff.normal.add,
|
||||||
NeoTreeGitConflict = { fg = palette.red },
|
NeoTreeGitConflict = theme.diff.normal.merge,
|
||||||
NeoTreeGitDeleted = { fg = palette.fg_inactive },
|
NeoTreeGitDeleted = theme.diff.normal.del,
|
||||||
NeoTreeGitIgnored = { fg = palette.fg },
|
NeoTreeGitIgnored = theme.inactive,
|
||||||
NeoTreeGitModified = { fg = palette.orange },
|
NeoTreeGitModified = theme.diff.normal.orange,
|
||||||
NeoTreeGitRenamed = { fg = palette.orange },
|
NeoTreeGitRenamed = { link = "NeoTreeGitModified" },
|
||||||
NeoTreeGitStaged = { fg = palette.aqua },
|
NeoTreeGitStaged = theme.diff.normal.staged,
|
||||||
NeoTreeGitUntracked = { fg = palette.yellow },
|
NeoTreeGitUntracked = theme.diff.normal.text,
|
||||||
NeoTreeGitUnstaged = { fg = palette.yellow },
|
NeoTreeGitUnstaged = { link = "NeoTreeFileName" },
|
||||||
|
|
||||||
|
NeoTreeCursorLine = theme.selection,
|
||||||
|
NeoTreeFloatBorder = theme.popup.border,
|
||||||
|
NeoTreeFloatTitle = theme.popup.title,
|
||||||
|
|
||||||
NeoTreeTitleBar = { fg = palette.ui.float.title2, bg = palette.ui.fg, bold = true },
|
|
||||||
NeoTreeSymbolicLinkTarget = { fg = palette.aqua },
|
NeoTreeSymbolicLinkTarget = { fg = palette.aqua },
|
||||||
NeoTreeTabActive = { fg = palette.ui.fg, bg = palette.ui.bg, bold = true },
|
NeoTreeTabActive = vim.tbl_extend("error", theme.statusbar.active, { bold = true }),
|
||||||
NeoTreeTabInactive = { fg = palette.ui.winbar.fg_inactive, bg = palette.ui.winbar.bg },
|
NeoTreeTabInactive = theme.winbar.inactive,
|
||||||
NeoTreeCursorLine = { fg = palette.none, bg = palette.ui.selection.bg },
|
NeoTreeTitleBar = theme.popup.title2,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
26
lua/astrobox/highlights/modules/nvim-notify.lua
Normal file
26
lua/astrobox/highlights/modules/nvim-notify.lua
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---@param theme Theme
|
||||||
|
---@param palette Palette
|
||||||
|
return function(theme, palette)
|
||||||
|
return {
|
||||||
|
NotifyERRORBorder = theme.msg.error,
|
||||||
|
NotifyWARNBorder = theme.msg.warning,
|
||||||
|
NotifyINFOBorder = theme.msg.info,
|
||||||
|
NotifyDEBUGBorder = theme.msg.hint,
|
||||||
|
NotifyTRACEBorder = theme.msg.error,
|
||||||
|
NotifyERRORIcon = { link = "NotifyERRORBorder" },
|
||||||
|
NotifyWARNIcon = { link = "NotifyWARNBorder" },
|
||||||
|
NotifyINFOIcon = { link = "NotifyINFOBorder" },
|
||||||
|
NotifyDEBUGIcon = { link = "NotifyDEBUGBorder" },
|
||||||
|
NotifyTRACEIcon = { link = "NotifyTRACEBorder" },
|
||||||
|
NotifyERRORTitle = { link = "NotifyERRORBorder" },
|
||||||
|
NotifyWARNTitle = { link = "NotifyWARNBorder" },
|
||||||
|
NotifyINFOTitle = { link = "NotifyINFOBorder" },
|
||||||
|
NotifyDEBUGTitle = { link = "NotifyDEBUGBorder" },
|
||||||
|
NotifyTRACETitle = { link = "NotifyTRACEBorder" },
|
||||||
|
NotifyERRORBody = { link = "Normal" },
|
||||||
|
NotifyWARNBody = { link = "Normal" },
|
||||||
|
NotifyINFOBody = { link = "Normal" },
|
||||||
|
NotifyDEBUGBody = { link = "Normal" },
|
||||||
|
NotifyTRACEBody = { link = "Normal" },
|
||||||
|
}
|
||||||
|
end
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
return function(palette)
|
---@param theme Theme
|
||||||
|
---@param palette Palette
|
||||||
|
return function(theme, palette)
|
||||||
return {
|
return {
|
||||||
Boolean = { fg = palette.yellow, bg = palette.none },
|
Boolean = { fg = palette.yellow, bg = palette.none },
|
||||||
Character = { link = "String" },
|
Character = { link = "String" },
|
||||||
@@ -36,20 +38,20 @@ return function(palette)
|
|||||||
Typedef = { link = "Keyword" },
|
Typedef = { link = "Keyword" },
|
||||||
|
|
||||||
-- Diags
|
-- Diags
|
||||||
DiagnosticError = { fg = palette.red },
|
DiagnosticError = theme.msg.error,
|
||||||
DiagnosticHint = { fg = palette.aqua },
|
DiagnosticHint = theme.msg.hint,
|
||||||
DiagnosticInfo = { fg = palette.blue },
|
DiagnosticInfo = theme.msg.info,
|
||||||
DiagnosticWarn = { fg = palette.yellow },
|
DiagnosticWarn = theme.msg.warning,
|
||||||
DiagnosticUnderlineError = { sp = palette.red, undercurl = true },
|
DiagnosticUnderlineError = { sp = palette.red, undercurl = true },
|
||||||
DiagnosticUnderlineHint = { sp = palette.aqua, undercurl = true },
|
DiagnosticUnderlineHint = { sp = palette.aqua, undercurl = true },
|
||||||
DiagnosticUnderlineInfo = { sp = palette.blue, undercurl = true },
|
DiagnosticUnderlineInfo = { sp = palette.blue, undercurl = true },
|
||||||
DiagnosticUnderlineWarn = { sp = palette.yellow, undercurl = true },
|
DiagnosticUnderlineWarn = { sp = palette.yellow, undercurl = true },
|
||||||
LspInlayHint = { fg = palette.other.conceal, bg = palette.other.hard_bg },
|
LspInlayHint = theme.conceal,
|
||||||
LspCodeLens = { link = "LspInlayHint" },
|
LspCodeLens = { link = "LspInlayHint" },
|
||||||
LspCodeLensSeparator = { link = "LspCodeLens" },
|
LspCodeLensSeparator = { link = "LspCodeLens" },
|
||||||
LspReferenceRead = { fg = palette.none, bg = palette.harder_bg },
|
LspReferenceRead = theme.active,
|
||||||
LspReferenceWrite = { fg = palette.none, bg = palette.harder_bg },
|
LspReferenceWrite = { fg = palette.none, bg = palette.harder_bg },
|
||||||
LspReferenceText = { fg = palette.none, bg = palette.softer_bg }, -- TODO Keep different?
|
LspReferenceText = theme.active,
|
||||||
|
|
||||||
["@annotation"] = { fg = palette.yellow },
|
["@annotation"] = { fg = palette.yellow },
|
||||||
["@attribute"] = { fg = palette.yellow },
|
["@attribute"] = { fg = palette.yellow },
|
||||||
|
|||||||
7
lua/astrobox/highlights/modules/vim-illuminate.lua
Normal file
7
lua/astrobox/highlights/modules/vim-illuminate.lua
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
return function()
|
||||||
|
return {
|
||||||
|
IlluminatedWordText = { link = "LspeferenceText" },
|
||||||
|
IlluminatedWordRead = { link = "LspeferenceRead" },
|
||||||
|
IlluminatedWordWrite = { link = "LspeferenceWrite" },
|
||||||
|
}
|
||||||
|
end
|
||||||
@@ -1,36 +1,45 @@
|
|||||||
|
local config = require("astrobox.config")
|
||||||
local palette = require("astrobox.palette")
|
local palette = require("astrobox.palette")
|
||||||
local highlights = require("astrobox.highlights")
|
local highlights = require("astrobox.highlights")
|
||||||
|
local theme = require("astrobox.theme")
|
||||||
local default_cfg = {
|
|
||||||
contrast = "default", -- soft, default or hard
|
|
||||||
overrides = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
local M = {
|
local M = {
|
||||||
cfg = {},
|
---@type Config
|
||||||
palette = {},
|
cfg = nil,
|
||||||
|
---@type Palette
|
||||||
|
palette = nil,
|
||||||
|
---@type Theme
|
||||||
|
theme = nil,
|
||||||
|
---@type table
|
||||||
hl = {},
|
hl = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---@param user_cfg Config
|
||||||
function M.setup(user_cfg)
|
function M.setup(user_cfg)
|
||||||
M.cfg = user_cfg
|
M.cfg = config.make_config(user_cfg)
|
||||||
|
-- If the colors are set, assume we're reloading and auto apply
|
||||||
|
if vim.g.colors_name == "astrobox" then
|
||||||
|
vim.notify("Reloading", vim.log.levels.INFO, { title = "Astrobox" })
|
||||||
|
vim.cmd.colorscheme("astrobox")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.set_highlights(list)
|
function M.set_highlights(list)
|
||||||
|
vim.cmd.highlight("clear")
|
||||||
for hl, def in pairs(list) do
|
for hl, def in pairs(list) do
|
||||||
vim.api.nvim_set_hl(0, hl, def)
|
vim.api.nvim_set_hl(0, hl, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.load()
|
function M.load()
|
||||||
local cfg = vim.tbl_extend("force", default_cfg, M.cfg or {})
|
M.palette = palette(M.cfg)
|
||||||
M.palette = palette(cfg)
|
M.theme = theme.make_theme(M.palette, M.cfg)
|
||||||
M.hl = highlights(M.palette, cfg)
|
M.hl = highlights.make_highlights(M.theme, M.palette, M.cfg)
|
||||||
for index, color in ipairs(M.palette.term_colors) do
|
for index, color in ipairs(M.theme.term_colors) do
|
||||||
vim.g["terminal_color_" .. index - 1] = color
|
vim.g["terminal_color_" .. index - 1] = color
|
||||||
end
|
end
|
||||||
vim.g.colors_name = "astrobox"
|
|
||||||
M.set_highlights(M.hl)
|
M.set_highlights(M.hl)
|
||||||
|
vim.g.colors_name = "astrobox"
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
local colors = require("astrobox.colors")
|
|
||||||
|
|
||||||
return function(config)
|
|
||||||
local vimbg = vim.o.background
|
|
||||||
local dark = vimbg == "dark"
|
|
||||||
local vimbg_reversed = dark and "light" or "dark"
|
|
||||||
|
|
||||||
-- Build base colors
|
|
||||||
local base = {
|
|
||||||
none = "NONE",
|
|
||||||
fg = colors.grayscale[vimbg_reversed][1],
|
|
||||||
bg = colors.bg[vimbg][config.contrast],
|
|
||||||
|
|
||||||
harder_bg = colors.bg.harder[vimbg][config.contrast],
|
|
||||||
softer_bg = colors.bg.softer[vimbg][config.contrast],
|
|
||||||
|
|
||||||
bg_gradiant = colors.grayscale[vimbg],
|
|
||||||
fg_gradiant = colors.grayscale[vimbg_reversed],
|
|
||||||
|
|
||||||
colored_backgrounds = colors.colored_backgrounds[vimbg][config.contrast],
|
|
||||||
|
|
||||||
gray = colors.gray,
|
|
||||||
}
|
|
||||||
-- Append colors
|
|
||||||
local palette = vim.tbl_extend("error", base, colors.colors[vimbg])
|
|
||||||
|
|
||||||
palette.ui = {
|
|
||||||
fg = palette.fg,
|
|
||||||
bg = palette.none,
|
|
||||||
bg_hard = palette.harder_bg,
|
|
||||||
fg_inactive = palette.fg_gradiant[4],
|
|
||||||
bg_inactive = palette.bg_gradiant[2],
|
|
||||||
float = {
|
|
||||||
title = palette.green,
|
|
||||||
title2 = palette.aqua,
|
|
||||||
border = palette.fg_gradiant[3],
|
|
||||||
text = palette.fg_gradiant[2],
|
|
||||||
scroll = palette.blue,
|
|
||||||
},
|
|
||||||
statusbar = {
|
|
||||||
fg = palette.fg,
|
|
||||||
bg = palette.bg_gradiant[1],
|
|
||||||
},
|
|
||||||
winbar = {
|
|
||||||
fg = palette.fg_gradiant[1],
|
|
||||||
bg = palette.harder_bg,
|
|
||||||
fg_inactive = palette.bg_gradiant[3],
|
|
||||||
bg_inactive = palette.harder_bg,
|
|
||||||
},
|
|
||||||
selection = {
|
|
||||||
fg = palette.fg,
|
|
||||||
bg = palette.colored_backgrounds.blue,
|
|
||||||
},
|
|
||||||
win = {
|
|
||||||
separator = palette.fg_gradiant[4],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
palette.other = {
|
|
||||||
conceal = palette.bg_gradiant[3],
|
|
||||||
hard_bg = palette.harder_bg,
|
|
||||||
bg_active = palette.softer_bg,
|
|
||||||
|
|
||||||
-- Special HL group to find what a group maps to
|
|
||||||
error_hl = { fg = "#000000", bg = "#FF00FF" },
|
|
||||||
}
|
|
||||||
|
|
||||||
palette.term_colors = {
|
|
||||||
palette.bg,
|
|
||||||
colors.term_colors.red,
|
|
||||||
colors.term_colors.green,
|
|
||||||
colors.term_colors.yellow,
|
|
||||||
colors.term_colors.blue,
|
|
||||||
colors.term_colors.purple,
|
|
||||||
colors.term_colors.aqua,
|
|
||||||
palette.fg_gradiant[4],
|
|
||||||
palette.gray,
|
|
||||||
colors.colors.red,
|
|
||||||
colors.colors.green,
|
|
||||||
colors.colors.yellow,
|
|
||||||
colors.colors.blue,
|
|
||||||
colors.colors.purple,
|
|
||||||
colors.colors.aqua,
|
|
||||||
palette.fg,
|
|
||||||
}
|
|
||||||
|
|
||||||
return palette
|
|
||||||
end
|
|
||||||
@@ -1,37 +1,46 @@
|
|||||||
|
---@class Colors
|
||||||
|
---@field red string
|
||||||
|
---@field green string
|
||||||
|
---@field yellow string
|
||||||
|
---@field blue string
|
||||||
|
---@field purple string
|
||||||
|
---@field aqua string
|
||||||
|
---@field orange string
|
||||||
|
|
||||||
return {
|
return {
|
||||||
none = nil,
|
none = "NONE",
|
||||||
bg = {
|
bg = {
|
||||||
dark = {
|
dark = {
|
||||||
soft = "#32302f",
|
soft = "#32302f",
|
||||||
default = "#282828",
|
medium = "#282828",
|
||||||
hard = "#1d2021",
|
hard = "#1d2021",
|
||||||
},
|
},
|
||||||
light = {
|
light = {
|
||||||
soft = "#f2e5bc",
|
soft = "#f2e5bc",
|
||||||
default = "#fbf1c7",
|
medium = "#fbf1c7",
|
||||||
hard = "#f9f5d7",
|
hard = "#f9f5d7",
|
||||||
},
|
},
|
||||||
harder = {
|
harder = {
|
||||||
dark = {
|
dark = {
|
||||||
soft = "#282828",
|
soft = "#282828",
|
||||||
default = "#1d2021",
|
medium = "#1d2021",
|
||||||
hard = "#171a1a",
|
hard = "#171a1a",
|
||||||
},
|
},
|
||||||
light = {
|
light = {
|
||||||
soft = "#fbf1c7",
|
soft = "#fbf1c7",
|
||||||
default = "#f9f5d7",
|
medium = "#f9f5d7",
|
||||||
hard = "#faf7df",
|
hard = "#faf7df",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
softer = {
|
softer = {
|
||||||
dark = {
|
dark = {
|
||||||
soft = "#343230",
|
soft = "#343230",
|
||||||
default = "#32302f",
|
medium = "#32302f",
|
||||||
hard = "#282828",
|
hard = "#282828",
|
||||||
},
|
},
|
||||||
light = {
|
light = {
|
||||||
soft = "#f1e3ba",
|
soft = "#f1e3ba",
|
||||||
default = "#f2e5bc",
|
medium = "#f2e5bc",
|
||||||
hard = "#fbf1c7",
|
hard = "#fbf1c7",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -55,6 +64,7 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
colors = {
|
colors = {
|
||||||
|
--- @type Colors
|
||||||
dark = {
|
dark = {
|
||||||
red = "#fb4934",
|
red = "#fb4934",
|
||||||
green = "#b8bb26",
|
green = "#b8bb26",
|
||||||
@@ -64,6 +74,7 @@ return {
|
|||||||
aqua = "#8ec07c",
|
aqua = "#8ec07c",
|
||||||
orange = "#fe8019",
|
orange = "#fe8019",
|
||||||
},
|
},
|
||||||
|
--- @type Colors
|
||||||
light = {
|
light = {
|
||||||
red = "#9d0006",
|
red = "#9d0006",
|
||||||
green = "#79740e",
|
green = "#79740e",
|
||||||
@@ -75,6 +86,7 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
--- @type Colors
|
||||||
term_colors = {
|
term_colors = {
|
||||||
red = "#cc241d",
|
red = "#cc241d",
|
||||||
green = "#98971a",
|
green = "#98971a",
|
||||||
@@ -84,47 +96,74 @@ return {
|
|||||||
aqua = "#689d6a",
|
aqua = "#689d6a",
|
||||||
orange = "#d65d0e",
|
orange = "#d65d0e",
|
||||||
},
|
},
|
||||||
|
-- Note: Lerped from colors and backgrounds.
|
||||||
colored_backgrounds = {
|
colored_backgrounds = {
|
||||||
|
-- Coeff is 0.8 with exceptions
|
||||||
dark = {
|
dark = {
|
||||||
|
--- @type Colors
|
||||||
soft = {
|
soft = {
|
||||||
red = "#5a3530",
|
red = "#5a3530",
|
||||||
green = "#4d4c2d",
|
green = "#4d4c2d",
|
||||||
yellow = "#6e5a2f",
|
yellow = "#6e5a2f", -- 0.7
|
||||||
blue = "#4a534f",
|
blue = "#4a534f",
|
||||||
|
purple = "#524145",
|
||||||
|
aqua = "#444d3e",
|
||||||
|
orange = "#5b402b",
|
||||||
},
|
},
|
||||||
default = {
|
--- @type Colors
|
||||||
|
medium = {
|
||||||
red = "#522f2a",
|
red = "#522f2a",
|
||||||
green = "#454528",
|
green = "#454528",
|
||||||
yellow = "#67552a",
|
yellow = "#67552a", -- 0.7
|
||||||
blue = "#434e4a",
|
blue = "#434e4a",
|
||||||
|
purple = "#4a3b3f",
|
||||||
|
aqua = "#3c4639",
|
||||||
|
orange = "#533a25",
|
||||||
},
|
},
|
||||||
|
--- @type Colors
|
||||||
hard = {
|
hard = {
|
||||||
red = "#492825",
|
red = "#492825",
|
||||||
green = "#3c3f22",
|
green = "#3c3f22",
|
||||||
yellow = "#5f4f25",
|
yellow = "#5f4f25", -- 0.7
|
||||||
blue = "#3c4845",
|
blue = "#3c4845",
|
||||||
|
purple = "#413439",
|
||||||
|
aqua = "#344033",
|
||||||
|
orange = "#4a331f",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- untested
|
||||||
|
-- 0.6 with exceptions
|
||||||
light = {
|
light = {
|
||||||
|
--- @type Colors
|
||||||
soft = {
|
soft = {
|
||||||
red = "#d08973",
|
red = "#d08973",
|
||||||
green = "#c2b876",
|
green = "#c2b876",
|
||||||
yellow = "#e0c48a",
|
yellow = "#e0c48a",
|
||||||
blue = "#acbfa8",
|
blue = "#acbfa8", -- 0.7
|
||||||
|
purple = "#caa39e",
|
||||||
|
aqua = "#acbb94",
|
||||||
|
orange = "#d7a172",
|
||||||
},
|
},
|
||||||
default = {
|
--- @type Colors
|
||||||
|
medium = {
|
||||||
red = "#d5917a",
|
red = "#d5917a",
|
||||||
green = "#c7bf7d",
|
green = "#c7bf7d",
|
||||||
yellow = "#e6cc91",
|
yellow = "#e6cc91",
|
||||||
blue = "#b2c7af",
|
blue = "#b2c7af", -- 0.7
|
||||||
|
purple = "#d0aaa5",
|
||||||
|
aqua = "#b1c29b",
|
||||||
|
orange = "#dda879",
|
||||||
},
|
},
|
||||||
|
--- @type Colors
|
||||||
hard = {
|
hard = {
|
||||||
red = "#d49383",
|
red = "#d49383",
|
||||||
green = "#c6c187",
|
green = "#c6c187",
|
||||||
yellow = "#e5cf9d",
|
yellow = "#e5cf9d",
|
||||||
blue = "#b0cabb",
|
blue = "#b0cabb", -- 0.7
|
||||||
|
purple = "#cfacae",
|
||||||
|
aqua = "#b0c4a4",
|
||||||
|
orange = "#dbaa82",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
44
lua/astrobox/palette/init.lua
Normal file
44
lua/astrobox/palette/init.lua
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---@class Palette : Colors
|
||||||
|
---@field none string
|
||||||
|
---@field fg string
|
||||||
|
---@field bg string
|
||||||
|
---@field harder_bg string
|
||||||
|
---@field softer_bg string
|
||||||
|
---@field bg_gradiant table
|
||||||
|
---@field fg_gradiant table
|
||||||
|
---@field colored_backgrounds Colors
|
||||||
|
---@field term_colors Colors
|
||||||
|
---@field gray string
|
||||||
|
|
||||||
|
local colors = require("astrobox.palette.colors")
|
||||||
|
|
||||||
|
-- TODO Split into palette and theme (float, bars)?
|
||||||
|
|
||||||
|
--- @return Palette
|
||||||
|
return function(config)
|
||||||
|
local vimbg = vim.o.background
|
||||||
|
local dark = vimbg == "dark"
|
||||||
|
local vimbg_reversed = dark and "light" or "dark"
|
||||||
|
|
||||||
|
-- Build base colors
|
||||||
|
local base = {
|
||||||
|
none = colors.none,
|
||||||
|
fg = colors.grayscale[vimbg_reversed][1],
|
||||||
|
bg = colors.bg[vimbg][config.contrast],
|
||||||
|
|
||||||
|
harder_bg = colors.bg.harder[vimbg][config.contrast],
|
||||||
|
softer_bg = colors.bg.softer[vimbg][config.contrast],
|
||||||
|
|
||||||
|
bg_gradiant = colors.grayscale[vimbg],
|
||||||
|
fg_gradiant = colors.grayscale[vimbg_reversed],
|
||||||
|
|
||||||
|
colored_backgrounds = colors.colored_backgrounds[vimbg][config.contrast],
|
||||||
|
term_colors = colors.term_colors,
|
||||||
|
|
||||||
|
gray = colors.gray,
|
||||||
|
}
|
||||||
|
-- Append colors
|
||||||
|
local palette = vim.tbl_extend("error", base, colors.colors[vimbg])
|
||||||
|
|
||||||
|
return palette
|
||||||
|
end
|
||||||
136
lua/astrobox/theme.lua
Normal file
136
lua/astrobox/theme.lua
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param P Palette
|
||||||
|
---@param C Config
|
||||||
|
---@return Theme
|
||||||
|
---@diagnostic disable-next-line: unused-local
|
||||||
|
function M.make_theme(P, C)
|
||||||
|
---@class Theme
|
||||||
|
local T = {
|
||||||
|
none = { fg = P.none, bg = P.none },
|
||||||
|
normal = { fg = P.fg, bg = P.bg },
|
||||||
|
inverted = { fg = P.bg, bg = P.fg },
|
||||||
|
inactive = { fg = P.fg_gradiant[4] },
|
||||||
|
conceal = { fg = P.bg_gradiant[3], bg = P.harder_bg },
|
||||||
|
active = { fg = P.none, bg = P.softer_bg },
|
||||||
|
}
|
||||||
|
T.colors = {
|
||||||
|
accent = P.blue,
|
||||||
|
accent2 = P.green,
|
||||||
|
accent3 = P.aqua,
|
||||||
|
}
|
||||||
|
T.backgrounds = {
|
||||||
|
red = { fg = P.none, bg = P.colored_backgrounds.red },
|
||||||
|
green = { fg = P.none, bg = P.colored_backgrounds.green },
|
||||||
|
yellow = { fg = P.none, bg = P.colored_backgrounds.yellow },
|
||||||
|
blue = { fg = P.none, bg = P.colored_backgrounds.blue },
|
||||||
|
purple = { fg = P.none, bg = P.colored_backgrounds.purple },
|
||||||
|
aqua = { fg = P.none, bg = P.colored_backgrounds.aqua },
|
||||||
|
orange = { fg = P.none, bg = P.colored_backgrounds.orange },
|
||||||
|
}
|
||||||
|
T.diff = {
|
||||||
|
normal = {
|
||||||
|
add = { fg = P.green, bg = P.none },
|
||||||
|
text = { fg = P.yellow, bg = P.none },
|
||||||
|
change = { fg = P.blue, bg = P.none },
|
||||||
|
del = { fg = P.red, bg = P.none },
|
||||||
|
merge = { fg = P.purple, bg = P.none },
|
||||||
|
staged = { fg = P.aqua, bg = P.none },
|
||||||
|
},
|
||||||
|
bg = {
|
||||||
|
add = T.backgrounds.green,
|
||||||
|
text = T.backgrounds.yellow,
|
||||||
|
change = T.backgrounds.blue,
|
||||||
|
del = T.backgrounds.red,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
T.msg = {
|
||||||
|
error = { fg = P.red, bg = P.none },
|
||||||
|
warning = { fg = P.yellow, bg = P.none },
|
||||||
|
info = { fg = P.blue, bg = P.none },
|
||||||
|
hint = { fg = P.aqua, bg = P.none },
|
||||||
|
}
|
||||||
|
T.files = {
|
||||||
|
directory = { fg = T.colors.accent },
|
||||||
|
file = { fg = T.normal.fg },
|
||||||
|
root = { fg = T.normal.fg, bold = true },
|
||||||
|
|
||||||
|
added = { fg = T.colors.diffadd },
|
||||||
|
changed = { fg = T.colors.difftext },
|
||||||
|
untracked = { fg = P.orange },
|
||||||
|
}
|
||||||
|
T.scrollbar = { fg = P.none, bg = P.colored_backgrounds.blue }
|
||||||
|
T.windows = {
|
||||||
|
separator = { fg = P.fg_gradiant[4], bg = P.none },
|
||||||
|
}
|
||||||
|
T.popup = {
|
||||||
|
normal = {
|
||||||
|
fg = P.fg,
|
||||||
|
bg = P.bg_gradiant[1],
|
||||||
|
},
|
||||||
|
conceal = T.conceal,
|
||||||
|
inactive = {
|
||||||
|
fg = P.fg_gradiant[4],
|
||||||
|
bg = P.bg_gradiant[2],
|
||||||
|
},
|
||||||
|
-- TODO Check if working good
|
||||||
|
border = C.float_no_borders and { fg = P.none, bg = P.none } or T.windows.separator,
|
||||||
|
title = { fg = T.colors.accent2, bg = P.none, bold = true }, -- TODO need to switch to normal.bg?
|
||||||
|
title2 = { fg = T.colors.accent3, bg = P.none, bold = true }, -- TODO need to switch to normal.bg?
|
||||||
|
}
|
||||||
|
T.selection = {
|
||||||
|
fg = P.fg,
|
||||||
|
bg = P.colored_backgrounds.blue,
|
||||||
|
}
|
||||||
|
T.menu = {
|
||||||
|
normal = { fg = P.fg_gradiant[1], bg = P.harder_bg },
|
||||||
|
selection = { fg = P.fg_gradiant[1], bg = T.selection.bg },
|
||||||
|
}
|
||||||
|
T.statusbar = {
|
||||||
|
normal = {
|
||||||
|
fg = P.fg_gradiant[1],
|
||||||
|
bg = P.harder_bg,
|
||||||
|
},
|
||||||
|
active = {
|
||||||
|
fg = P.fg_gradiant[1],
|
||||||
|
bg = P.harder_bg,
|
||||||
|
},
|
||||||
|
inactive = {
|
||||||
|
fg = P.fg,
|
||||||
|
bg = P.bg_gradiant[1],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
T.winbar = {
|
||||||
|
normal = {
|
||||||
|
fg = P.fg_gradiant[1],
|
||||||
|
bg = P.harder_bg,
|
||||||
|
},
|
||||||
|
inactive = {
|
||||||
|
fg = P.bg_gradiant[3],
|
||||||
|
bg = P.harder_bg,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
T.term_colors = {
|
||||||
|
P.bg,
|
||||||
|
P.term_colors.red,
|
||||||
|
P.term_colors.green,
|
||||||
|
P.term_colors.yellow,
|
||||||
|
P.term_colors.blue,
|
||||||
|
P.term_colors.purple,
|
||||||
|
P.term_colors.aqua,
|
||||||
|
P.fg_gradiant[4],
|
||||||
|
P.gray,
|
||||||
|
P.red,
|
||||||
|
P.green,
|
||||||
|
P.yellow,
|
||||||
|
P.blue,
|
||||||
|
P.purple,
|
||||||
|
P.aqua,
|
||||||
|
P.fg,
|
||||||
|
}
|
||||||
|
|
||||||
|
T.error = { fg = "#000000", bg = "#FF00FF" }
|
||||||
|
return T
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
@@ -9,11 +9,13 @@ ASTROBOX_ROOT_PATH = get_module_root_path("astrobox")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
---@param module string
|
||||||
|
---@param visitor function
|
||||||
function M.visit_astrobox_modules(module, visitor)
|
function M.visit_astrobox_modules(module, visitor)
|
||||||
local modpath = ASTROBOX_ROOT_PATH .. module:gsub("%.", "/")
|
local modpath = ASTROBOX_ROOT_PATH .. module:gsub("%.", "/")
|
||||||
local hdl, err, msg = vim.loop.fs_scandir(modpath)
|
local hdl, err, msg = vim.loop.fs_scandir(modpath)
|
||||||
if hdl == nil then
|
if hdl == nil then
|
||||||
print("Astrobox err: " .. err .. " " .. vim.inspect(msg))
|
vim.notify("Astrobox err: " .. err .. " " .. vim.inspect(msg), vim.log.levels.ERROR)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
while true do
|
while true do
|
||||||
@@ -27,7 +29,7 @@ function M.visit_astrobox_modules(module, visitor)
|
|||||||
if ok then
|
if ok then
|
||||||
visitor(mod, mod_name)
|
visitor(mod, mod_name)
|
||||||
else
|
else
|
||||||
print("AstroBox:Failed to load module " .. mod_name)
|
vim.notify("AstroBox:Failed to load module " .. mod_name, vim.log.levels.ERROR)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user