diff --git a/colors/astrobox.lua b/colors/astrobox.lua index 8deb29d..2e1c0f9 100644 --- a/colors/astrobox.lua +++ b/colors/astrobox.lua @@ -1 +1 @@ -require("astrotheme").load "astrobox" +require("astrobox").load() diff --git a/lua/astrobox/colors.lua b/lua/astrobox/colors.lua new file mode 100644 index 0000000..a9cd0ed --- /dev/null +++ b/lua/astrobox/colors.lua @@ -0,0 +1,131 @@ +return { + none = nil, + bg = { + dark = { + soft = "#32302f", + default = "#282828", + hard = "#1d2021", + }, + light = { + soft = "#f2e5bc", + default = "#fbf1c7", + hard = "#f9f5d7", + }, + harder = { + dark = { + soft = "#282828", + default = "#1d2021", + hard = "#171a1a", + }, + light = { + soft = "#fbf1c7", + default = "#f9f5d7", + hard = "#faf7df", + }, + }, + softer = { + dark = { + soft = "#343230", + default = "#32302f", + hard = "#282828", + }, + light = { + soft = "#f1e3ba", + default = "#f2e5bc", + hard = "#fbf1c7", + }, + }, + }, + + gray = "#928374", + + grayscale = { + dark = { + "#3c3836", + "#504945", + "#665c54", + "#7c6f64", + }, + light = { + "#ebdbb2", + "#d5c4a1", + "#bdae93", + "#a89984", + }, + }, + + colors = { + dark = { + red = "#fb4934", + green = "#b8bb26", + yellow = "#fabd2f", + blue = "#83a598", + purple = "#d3869b", + aqua = "#8ec07c", + orange = "#fe8019", + }, + light = { + red = "#9d0006", + green = "#79740e", + yellow = "#b57614", + blue = "#076678", + purple = "#8f3f71", + aqua = "#427b58", + orange = "#af3a03", + }, + }, + + term_colors = { + red = "#cc241d", + green = "#98971a", + yellow = "#d79921", + blue = "#458588", + purple = "#b16286", + aqua = "#689d6a", + orange = "#d65d0e", + }, + + colored_backgrounds = { + dark = { + soft = { + red = "#5a3530", + green = "#4d4c2d", + yellow = "#6e5a2f", + blue = "#4a534f", + }, + default = { + red = "#522f2a", + green = "#454528", + yellow = "#67552a", + blue = "#434e4a", + }, + hard = { + red = "#492825", + green = "#3c3f22", + yellow = "#5f4f25", + blue = "#3c4845", + }, + }, + + light = { + soft = { + red = "#d08973", + green = "#c2b876", + yellow = "#e0c48a", + blue = "#acbfa8", + }, + default = { + red = "#d5917a", + green = "#c7bf7d", + yellow = "#e6cc91", + blue = "#b2c7af", + }, + hard = { + red = "#d49383", + green = "#c6c187", + yellow = "#e5cf9d", + blue = "#b0cabb", + }, + }, + }, +} diff --git a/lua/astrobox/highlights/init.lua b/lua/astrobox/highlights/init.lua new file mode 100644 index 0000000..4d2b5cc --- /dev/null +++ b/lua/astrobox/highlights/init.lua @@ -0,0 +1,18 @@ +local utils = require("astrobox.utils") + +return function(palette, config) + local HL = {} + local function load_mod(mod, mod_name) + local ok, res = pcall(mod, palette, config) + if ok and res then + HL = vim.tbl_extend("error", HL, res) + else + vim.notify("Failed to load module " .. mod_name .. " (" .. res .. ")") + end + end + utils.visit_astrobox_modules("highlights.modules", load_mod) + + HL = vim.tbl_extend("force", HL, config.overrides) + + return HL +end diff --git a/lua/astrobox/highlights/modules/astro_heirline.lua b/lua/astrobox/highlights/modules/astro_heirline.lua new file mode 100644 index 0000000..017d958 --- /dev/null +++ b/lua/astrobox/highlights/modules/astro_heirline.lua @@ -0,0 +1,11 @@ +return function() + return { + HeirlineInactive = { link = "StatusInactive" }, + HeirlineNormal = { link = "StatusNormal" }, + HeirlineInsert = { link = "StatusInsert" }, + HeirlineVisual = { link = "StatusVisual" }, + HeirlineReplace = { link = "StatusReplace" }, + HeirlineCommand = { link = "StatusCommand" }, + HeirlineTerminal = { link = "StatusTerminal" }, + } +end diff --git a/lua/astrobox/highlights/modules/c.lua b/lua/astrobox/highlights/modules/c.lua new file mode 100644 index 0000000..012d562 --- /dev/null +++ b/lua/astrobox/highlights/modules/c.lua @@ -0,0 +1,6 @@ +return function() + return { + cInclude = { link = "PreProc" }, + cDefine = { link = "PreProc" }, -- Fix C ft setting this to Macro + } +end diff --git a/lua/astrobox/highlights/modules/core.lua b/lua/astrobox/highlights/modules/core.lua new file mode 100644 index 0000000..f06a47f --- /dev/null +++ b/lua/astrobox/highlights/modules/core.lua @@ -0,0 +1,133 @@ +return function(palette) + return { + Normal = { fg = palette.fg, bg = palette.bg }, + NormalNC = { link = "Normal" }, + -- Italic = { italic = true }, + -- Bold = { bold = true }, + Conceal = { fg = palette.other.conceal, bg = palette.other.harder_bg }, + SpecialKey = { fg = palette.none, bg = palette.colored_backgrounds.yellow }, + NonText = { fg = palette.ui.fg_inactive, bg = palette.none }, + EndOfBuffer = { fg = palette.bg, bg = palette.bg }, + + Directory = { fg = palette.blue, bg = palette.none }, + QuickFixLine = palette.ui.selection, + MatchParen = { fg = palette.none, bg = palette.none, bold = true, underline = true }, + Underlined = { fg = palette.cyan, bg = palette.none, underline = true }, + + -- Popup + + FloatTitle = { + fg = palette.ui.float.title, + bg = palette.ui.bg, + 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 + + TabLine = { fg = palette.ui.fg_inactive, bg = palette.ui.bg_inactive }, + TabLineFill = { fg = palette.none, bg = palette.ui.bg_inactive }, + TabLineSel = { fg = palette.ui.fg, bg = palette.ui.bg, bold = true, italic = true }, + + WinBar = { fg = palette.ui.winbar.fg, bg = palette.ui.winbar.bg }, + WinBarNC = { + fg = palette.ui.winbar.fg_inactive, + bg = palette.ui.winbar.bg_inactive, + }, + + StatusLine = { fg = palette.ui.fg, bg = palette.ui.bg }, + StatusLineNC = { fg = palette.ui.fg_inactive, bg = palette.ui.bg }, + StatusNormal = { fg = palette.ui.bg, bg = palette.blue }, + StatusInsert = { fg = palette.ui.bg, bg = palette.green }, + StatusVisual = { fg = palette.ui.bg, bg = palette.purple }, + StatusReplace = { fg = palette.ui.bg, bg = palette.red }, + StatusCommand = { fg = palette.ui.bg, bg = palette.yellow }, + StatusTerminal = { link = "StatusInsert" }, + + -- Cursor + + Cursor = { fg = palette.fg, bg = palette.bg }, + CursorIM = { link = "Cursor" }, + lCursor = { link = "Cursor" }, + CursorLineNr = { fg = palette.ui.fg, bg = palette.none }, + LineNr = { fg = palette.ui.fg_inactive, bg = palette.none }, + + -- Columns + + Folded = { fg = palette.ui.fg_inactive, bg = palette.none }, + FoldColumn = { fg = palette.ui.fg_inactive, bg = palette.none }, + SignColumn = { fg = palette.none, bg = palette.none }, -- TODO Test + ColorColumn = { fg = palette.none, bg = palette.other.bg_active }, + CursorLine = { fg = palette.none, bg = palette.other.bg_active }, + CursorColumn = { link = "CursorLine" }, + + -- Splits + + WinSeparator = { + fg = palette.ui.win.separator, + bg = palette.bg, + -- bold = false, + }, + VertSplit = { + fg = palette.ui.win.separator, + bg = palette.bg, + }, + + -- Diff + + DiffAdd = { fg = palette.none, bg = palette.colored_backgrounds.green }, + DiffChange = { fg = palette.none, bg = palette.colored_backgrounds.blue }, + DiffDelete = { fg = palette.none, bg = palette.colored_backgrounds.red }, + DiffText = { fg = palette.none, bg = palette.colored_backgrounds.yellow }, + DiffAdded = { link = "DiffAdd" }, + DiffRemoved = { link = "DiffDelete" }, + DiffChanged = { link = "DiffText" }, -- TODO Switch to DiffChange? + DiffOldFile = { fg = palette.red, bg = palette.bg }, + DiffNewFile = { fg = palette.green, bg = palette.bg }, + DiffFile = palette.other.error_hl, -- TODO What's this? + DiffLine = palette.other.error_hl, -- TODO What's this? + DiffIndexLine = palette.other.error_hl, -- TODO What's this? + + -- Cmd + + ErrorMsg = { fg = palette.red, bg = palette.none }, + WarningMsg = { fg = palette.yellow, bg = palette.none }, + Question = { fg = palette.blue, bg = palette.none }, + WildMenu = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg }, + + -- PMenu + + Pmenu = { fg = palette.ui.fg, bg = palette.ui.bg_hard }, + PmenuSel = { fg = palette.ui.selection.fg, bg = palette.ui.selection.bg }, + PmenuSbar = { fg = palette.none, bg = palette.ui.float.scroll }, + PmenuThumb = { link = "PmenuSbar" }, + + -- Search + + Search = { fg = palette.fg, bg = palette.other.bg_active }, + IncSearch = { fg = palette.none, bg = palette.colored_backgrounds.blue }, + Substitute = { fg = palette.none, bg = palette.colored_backgrounds.yellow }, + CurSearch = { link = "IncSearch" }, + Visual = { fg = palette.none, bg = palette.other.bg_active }, + VisualNOS = { fg = palette.other.bg_active, bg = palette.fg }, -- Meh + + -- Spelling + + SpellBad = { undercurl = true }, + SpellCap = { undercurl = true }, + SpellLocal = { undercurl = true }, + SpellRare = { undercurl = true }, + } +end diff --git a/lua/astrobox/highlights/modules/gitsigns.lua b/lua/astrobox/highlights/modules/gitsigns.lua new file mode 100644 index 0000000..21d4dc1 --- /dev/null +++ b/lua/astrobox/highlights/modules/gitsigns.lua @@ -0,0 +1,7 @@ +return function(palette) + return { + GitSignsAdd = { fg = palette.green }, + GitSignsChange = { fg = palette.yellow }, + GitSignsDelete = { fg = palette.red }, + } +end diff --git a/lua/astrobox/highlights/modules/syntax.lua b/lua/astrobox/highlights/modules/syntax.lua new file mode 100644 index 0000000..1a072aa --- /dev/null +++ b/lua/astrobox/highlights/modules/syntax.lua @@ -0,0 +1,170 @@ +return function(palette) + return { + Boolean = { fg = palette.yellow, bg = palette.none }, + Character = { link = "String" }, + Comment = { fg = palette.gray, bg = palette.none, italic = true }, + Conditional = { link = "Keyword" }, + Constant = { fg = palette.aqua }, + Debug = { fg = palette.blue, bg = palette.none }, + Define = { link = "PreProc" }, + Delimiter = { fg = palette.yellow, bg = palette.none }, + Error = { fg = palette.red, bg = palette.none }, + Exception = { link = "Keyword" }, + Float = { link = "Number" }, + Function = { fg = palette.fg_gradiant[1], bg = palette.none }, + Identifier = { fg = palette.fg, bg = palette.none }, + Ignore = { fg = palette.none, bg = palette.none }, + Include = { link = "Keyword" }, + Keyword = { fg = palette.red, bg = palette.none }, + Label = { link = "Keyword" }, + Macro = { fg = palette.orange, bg = palette.none }, + Number = { fg = palette.yellow, bg = palette.none }, + Operator = { fg = palette.orange, bg = palette.none }, + PreCondit = { link = "PreProc" }, + PreProc = { fg = palette.gray, bg = palette.none }, + Repeat = { link = "Keyword" }, + Special = { fg = palette.blue, bg = palette.none }, + SpecialChar = { fg = palette.aqua, bg = palette.none }, + SpecialComment = { fg = palette.bg_gradiant[4], bg = palette.none }, + Statement = { link = "Identifier" }, + StorageClass = { link = "Keyword" }, + String = { fg = palette.green, bg = palette.none }, + Structure = { link = "Keyword" }, + Tag = { fg = palette.blue, bg = palette.none }, + Todo = { fg = palette.yellow, bg = palette.harder_bg }, + Type = { fg = palette.yellow, bg = palette.none }, + Typedef = { link = "Keyword" }, + + -- Diags + DiagnosticError = { fg = palette.red }, + DiagnosticHint = { fg = palette.aqua }, + DiagnosticInfo = { fg = palette.blue }, + DiagnosticWarn = { fg = palette.yellow }, + DiagnosticUnderlineError = { sp = palette.red, undercurl = true }, + DiagnosticUnderlineHint = { sp = palette.aqua, undercurl = true }, + DiagnosticUnderlineInfo = { sp = palette.blue, undercurl = true }, + DiagnosticUnderlineWarn = { sp = palette.yellow, undercurl = true }, + LspInlayHint = { fg = palette.other.conceal, bg = palette.other.hard_bg }, + LspCodeLens = { link = "LspInlayHint" }, + LspCodeLensSeparator = { link = "LspCodeLens" }, + LspReferenceRead = { 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? + + ["@annotation"] = { fg = palette.yellow }, + ["@attribute"] = { fg = palette.yellow }, + ["@boolean"] = { link = "Boolean" }, + ["@character"] = { link = "Character" }, + ["@character.special"] = { link = "SpecialChar" }, + ["@class"] = { fg = palette.yellow }, + ["@comment"] = { link = "Comment" }, + ["@comment.documentation"] = { fg = palette.gray, italic = false }, + ["@conditional"] = { link = "Conditional" }, + ["@constant"] = { link = "Constant" }, + ["@constant.builtin"] = { link = "@constant" }, + ["@constant.macro"] = { link = "@constant" }, + ["@constructor"] = { fg = palette.fg_gradiant[1], bold = true }, + ["@debug"] = { link = "Debug" }, + ["@decorator"] = { fg = palette.orange }, + ["@define"] = { link = "Define" }, + ["@enum"] = { fg = palette.cyan }, + ["@enumMember"] = { fg = palette.blue }, + ["@error"] = { link = "Error" }, + ["@event"] = { fg = palette.orange }, + ["@exception"] = { link = "Exception" }, + ["@field"] = { link = "Identifier" }, + ["@float"] = { link = "Float" }, + ["@function"] = { link = "Function" }, + ["@function.macro"] = { link = "Macro" }, + ["@include"] = { link = "Include" }, + ["@interface"] = { fg = palette.orange }, + ["@keyword"] = { link = "Keyword" }, + ["@label"] = { link = "Label" }, + ["@method"] = { fg = palette.fg_gradiant[1] }, + ["@modifier"] = { fg = palette.orange }, + ["@namespace"] = { fg = palette.fg_gradiant[2] }, + ["@none"] = { link = "Conceal" }, + ["@number"] = { link = "Number" }, + ["@operator"] = { link = "Operator" }, + ["@parameter"] = { fg = palette.fg_gradiant[1] }, + ["@preproc"] = { link = "PreProc" }, + ["@property"] = { link = "@field" }, + ["@punctuation.bracket"] = { link = "Identifier" }, + ["@punctuation.delimiter"] = { fg = palette.orange }, + ["@punctuation.special"] = { link = "Special" }, + ["@regexp"] = { fg = palette.cyan }, + ["@repeat"] = { link = "Repeat" }, + ["@storageclass"] = { link = "StorageClass" }, + ["@storageclass.lifeTime"] = { fg = palette.purple }, + ["@string"] = { link = "String" }, + ["@string.escape"] = { fg = palette.red }, + ["@string.regex"] = { fg = palette.aqua }, + ["@string.special"] = { link = "Special" }, + ["@struct"] = { fg = palette.yellow }, + ["@symbol"] = { link = "Special" }, + ["@tag"] = { fg = palette.red }, + ["@tag.attribute"] = { fg = palette.yellow }, + ["@tag.delimiter"] = { fg = palette.fg }, + ["@text"] = { fg = palette.fg }, + ["@text.checked"] = { fg = palette.green }, + ["@text.danger"] = { fg = palette.red }, + ["@text.diff.add"] = { link = "DiffAdded" }, + ["@text.diff.delete"] = { link = "DiffDelete" }, + ["@text.emphasis"] = { fg = palette.fg, italic = true }, + ["@text.environment"] = { fg = palette.yellow }, + ["@text.environment.name"] = { fg = palette.orange }, + ["@text.literal"] = { fg = palette.fg }, + ["@text.math"] = { fg = palette.aqua }, + ["@text.note"] = { fg = palette.aqua }, + ["@text.quote"] = { fg = palette.fg, italic = true }, + ["@text.reference"] = { fg = palette.aqua, bold = true }, + ["@text.strike"] = { fg = palette.fg, strikethrough = true }, + ["@text.strong"] = { fg = palette.fg, bold = true }, + ["@text.title"] = { fg = palette.green, bold = true }, + ["@text.title.1.markdown"] = { fg = palette.blue, bold = true }, + ["@text.title.2.markdown"] = { fg = palette.aqua, bold = true }, + ["@text.title.3.markdown"] = { fg = palette.purple, bold = true }, + ["@text.title.4.markdown"] = { fg = palette.yellow, bold = true }, + ["@text.todo"] = { link = "Todo" }, + ["@text.todo.checked"] = { link = "@text.checked" }, + ["@text.todo.danger"] = { link = "@text.danger" }, + ["@text.todo.note"] = { link = "@text.note" }, + ["@text.todo.unchecked"] = { link = "@text.unchecked" }, + ["@text.todo.warning"] = { link = "@text.warning" }, + ["@text.unchecked"] = { fg = palette.blue }, + ["@text.underline"] = { link = "Underline" }, + ["@text.uri"] = { link = "Underlined" }, + ["@text.warning"] = { fg = palette.yellow }, + ["@type"] = { link = "Type" }, + ["@type.qualifier"] = { fg = palette.purple }, + ["@typeParameter"] = { fg = palette.yellow }, + ["@variable"] = { link = "Identifier" }, + ["@variable.builtin"] = { bold = true }, + + -- LSP + ["@lsp.mod.attribute"] = { link = "@attribute" }, + ["@lsp.mod.documentation"] = { link = "@comment.documentation" }, + ["@lsp.type"] = { link = "@type" }, + ["@lsp.type.attributeBracket"] = { fg = palette.orange }, + ["@lsp.type.derive"] = { fg = palette.orange }, + ["@lsp.type.enum"] = { link = "@enum" }, + ["@lsp.type.enumMember"] = { link = "@enumMember" }, + ["@lsp.type.interface"] = { fg = palette.orange }, + ["@lsp.type.keyword"] = { link = "Keyword" }, + ["@lsp.type.lifeTime"] = { fg = palette.purple }, + ["@lsp.type.method"] = { link = "@method" }, + ["@lsp.type.namespace"] = { fg = palette.fg_gradiant[1] }, + ["@lsp.type.operator"] = { link = "Operator" }, + ["@lsp.type.parameter"] = { link = "@parameter" }, + ["@lsp.type.property"] = { link = "@property" }, + ["@lsp.type.selfTypeKeyword"] = { fg = palette.aqua, bold = true }, + ["@lsp.type.struct"] = { link = "@struct" }, + ["@lsp.type.typeParameter"] = { link = "@type" }, + ["@lsp.type.variable"] = { link = "@variable" }, + ["@lsp.typemod.class.constructorOrDestructor"] = { link = "@constructor" }, + ["@lsp.typemod.method"] = { link = "@method" }, + ["@lsp.typemod.selfKeyword"] = { fg = palette.fg_gradiant[1], bold = true }, + ["@lsp.typemod.string.attribute"] = { link = "String" }, -- Hmmmm + ["@lsp.typemod.variable.readonly"] = { link = "Constant" }, + } +end diff --git a/lua/astrobox/init.lua b/lua/astrobox/init.lua new file mode 100644 index 0000000..04e762e --- /dev/null +++ b/lua/astrobox/init.lua @@ -0,0 +1,36 @@ +local palette = require("astrobox.palette") +local highlights = require("astrobox.highlights") + +local default_cfg = { + contrast = "default", -- soft, default or hard + overrides = {} +} + +local M = { + cfg = {}, + palette = {}, + hl = {}, +} + +function M.setup(user_cfg) + M.cfg = user_cfg +end + +function M.set_highlights(list) + for hl, def in pairs(list) do + vim.api.nvim_set_hl(0, hl, def) + end +end + +function M.load() + local cfg = vim.tbl_extend("force", default_cfg, M.cfg or {}) + M.palette = palette(cfg) + M.hl = highlights(M.palette, cfg) + for index, color in ipairs(M.palette.term_colors) do + vim.g["terminal_color_" .. index - 1] = color + end + vim.g.colors_name = "astrobox" + M.set_highlights(M.hl) +end + +return M diff --git a/lua/astrobox/palette.lua b/lua/astrobox/palette.lua new file mode 100644 index 0000000..6690120 --- /dev/null +++ b/lua/astrobox/palette.lua @@ -0,0 +1,84 @@ +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 = "", + 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, -- TODO Rémy Only for comments? Won't look good in light mode + } + -- Append colors + local palette = vim.tbl_extend("error", base, colors.colors[vimbg]) + + palette.ui = { + fg = palette.fg, + bg = palette.bg_gradiant[1], + 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[2], + text = palette.fg_gradiant[1], + scroll = palette.blue, + }, + 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.bg_gradiant[1], + + -- 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 diff --git a/lua/astrobox/utils.lua b/lua/astrobox/utils.lua new file mode 100644 index 0000000..a1d96a3 --- /dev/null +++ b/lua/astrobox/utils.lua @@ -0,0 +1,36 @@ +local function get_module_root_path(modname) + local list = vim.loader.find(modname) + if list and #list then + return list[1].modpath:sub(0, -9) -- Cut init.lua + end +end + +ASTROBOX_ROOT_PATH = get_module_root_path("astrobox") + +local M = {} + +function M.visit_astrobox_modules(module, visitor) + local modpath = ASTROBOX_ROOT_PATH .. module:gsub("%.", "/") + local hdl, err, msg = vim.loop.fs_scandir(modpath) + if hdl == nil then + print("Astrobox err: " .. err .. " " .. vim.inspect(msg)) + return + end + while true do + local entry, type = vim.loop.fs_scandir_next(hdl) + if entry == nil then + break + end + if type == "file" and vim.endswith(entry, ".lua") then + local mod_name = entry:sub(0, -5) -- cut extension + local ok, mod = pcall(require, "astrobox." .. module .. "." .. mod_name) + if ok then + visitor(mod, mod_name) + else + print("AstroBox:Failed to load module " .. mod_name) + end + end + end +end + +return M diff --git a/lua/astrotheme/palettes/astrobox.lua b/lua/astrotheme/palettes/astrobox.lua deleted file mode 100644 index 768513f..0000000 --- a/lua/astrotheme/palettes/astrobox.lua +++ /dev/null @@ -1,123 +0,0 @@ -local c = { - none = "NONE", - syntax = {}, - ui = {}, - term = {}, -} - --------------------------------- ---- Syntax --------------------------------- -c.syntax.red = "#fb4934" -c.syntax.orange = "#fe8019" -c.syntax.yellow = "#fabd2f" -c.syntax.green = "#b8bb26" -c.syntax.cyan = "#8ec07c" -c.syntax.blue = "#83a598" -c.syntax.purple = "#d3869b" -c.syntax.text = "#ebdbb2" -c.syntax.comment = "#928374" -c.syntax.mute = "#504945" - --------------------------------- ---- UI --------------------------------- -c.ui.red = "#cc241d" -c.ui.orange = "#d65d0e" -c.ui.yellow = "#d79921" -c.ui.green = "#98971a" -c.ui.cyan = "#689d6a" -c.ui.blue = "#458588" -c.ui.purple = "#b16286" - -c.ui.accent = "#98971a" - -c.ui.tabline = "#282828" -c.ui.winbar = "#a89984" -c.ui.tool = "#171a1a" -c.ui.base = "#1d2021" -c.ui.inactive_base = c.ui.tool -c.ui.statusline = c.ui.tabline -c.ui.split = c.ui.winbar -c.ui.popup = c.ui.inactive_base -c.ui.float = c.ui.inactive_base -c.ui.title = c.ui.accent -c.ui.border = "#f9f5d7" -c.ui.current_line = "#32302f" -c.ui.scrollbar = c.ui.accent -c.ui.selection = "#3c3836" -c.ui.menu_selection = c.ui.accent -c.ui.highlight = c.ui.tool -c.ui.none_text = "#7c6f64" -c.ui.text = "#ebdbb2" -c.ui.text_active = "#f9f5d7" -c.ui.text_inactive = c.ui.winbar -c.ui.text_match = c.ui.accent - --------------------------------- ---- terminal --------------------------------- -c.term.black = c.ui.tabline -c.term.bright_black = c.ui.tabline - -c.term.red = c.syntax.red -c.term.bright_red = c.syntax.red - -c.term.green = c.syntax.green -c.term.bright_green = c.syntax.green - -c.term.yellow = c.syntax.yellow -c.term.bright_yellow = c.syntax.yellow - -c.term.blue = c.syntax.blue -c.term.bright_blue = c.syntax.blue - -c.term.purple = c.syntax.purple -c.term.bright_purple = c.syntax.purple - -c.term.cyan = c.syntax.cyan -c.term.bright_cyan = c.syntax.cyan - -c.term.white = c.ui.text -c.term.bright_white = c.ui.text_active - -c.term.background = c.ui.base -c.term.foreground = c.ui.text - --------------------------------- ---- Icons --------------------------------- -c.icon = { - c = "#519aba", - css = "#61afef", - deb = "#a1b7ee", - docker = "#384d54", - html = "#de8c92", - jpeg = "#c882e7", - jpg = "#c882e7", - js = "#ebcb8b", - jsx = "#519ab8", - kt = "#7bc99c", - lock = "#c4c720", - lua = "#51a0cf", - mp3 = "#d39ede", - mp4 = "#9ea3de", - out = "#abb2bf", - png = "#c882e7", - py = "#a3b8ef", - rb = "#ff75a0", - robots = "#abb2bf", - rpm = "#fca2aa", - rs = "#dea584", - toml = "#39bf39", - ts = "#519aba", - ttf = "#abb2bf", - vue = "#7bc99c", - woff = "#abb2bf", - woff2 = "#abb2bf", - zip = "#f9d71c", - md = "#519aba", - pkg = "#d39ede", -} - -return c