diff --git a/lua/astrotheme/colors.lua b/lua/astrotheme/colors.lua deleted file mode 100644 index fe7aa7e..0000000 --- a/lua/astrotheme/colors.lua +++ /dev/null @@ -1,82 +0,0 @@ -local colors = { - none = "NONE", - fg = "#abb2bf", - bg = "#1e222a", - bg_1 = "#303742", - black = "#181a1f", - black_1 = "#1f1f25", - green = "#98c379", - green_1 = "#89b06d", - green_2 = "#95be76", - white = "#dedede", - white_1 = "#afb2bb", - white_2 = "#c9c9c9", - blue = "#61afef", - blue_1 = "#40d9ff", - blue_2 = "#1b1f27", - blue_3 = "#8094B4", - blue_4 = "#90c7f3", - orange = "#d19a66", - orange_1 = "#ff9640", - orange_2 = "#ff8800", - yellow = "#e5c07b", - yellow_1 = "#ebae34", - yellow_2 = "#d1b071", - red = "#e06c75", - red_1 = "#ec5f67", - red_2 = "#ffbba6", - red_3 = "#cc626a", - red_4 = "#d47d85", - red_5 = "#e9989e", - grey = "#5c6370", - grey_1 = "#4b5263", - grey_2 = "#777d86", - grey_3 = "#282c34", - grey_4 = "#2c323c", - grey_5 = "#3e4452", - grey_6 = "#3b4048", - grey_7 = "#5c5c5c", - grey_8 = "#252931", - grey_9 = "#787e87", - grey_10 = "#D3D3D3", - gold = "#ffcc00", - cyan = "#56b6c2", - cyan_1 = "#88cbd4", - purple = "#c678dd", - purple_1 = "#a9a1e1", - purple_2 = "#c2bdea", - - -- icon colors - 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 colors diff --git a/lua/astrotheme/groups/astronvim.lua b/lua/astrotheme/groups/astronvim.lua index 726fe6b..46c1d6a 100644 --- a/lua/astrotheme/groups/astronvim.lua +++ b/lua/astrotheme/groups/astronvim.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { HighlightURL = { underline = true }, diff --git a/lua/astrotheme/groups/base.lua b/lua/astrotheme/groups/base.lua index 19cca8b..c2b3e3c 100644 --- a/lua/astrotheme/groups/base.lua +++ b/lua/astrotheme/groups/base.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) return { -------------------- diff --git a/lua/astrotheme/groups/lsp.lua b/lua/astrotheme/groups/lsp.lua index 4dad5cd..a8171a1 100644 --- a/lua/astrotheme/groups/lsp.lua +++ b/lua/astrotheme/groups/lsp.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) local error = C.ui.red local hint = C.ui.cyan diff --git a/lua/astrotheme/groups/plugins/aerial.lua b/lua/astrotheme/groups/plugins/aerial.lua index 2d8f7db..eaed468 100644 --- a/lua/astrotheme/groups/plugins/aerial.lua +++ b/lua/astrotheme/groups/plugins/aerial.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { AerialNormal = { fg = C.ui.text }, diff --git a/lua/astrotheme/groups/plugins/beacon.lua b/lua/astrotheme/groups/plugins/beacon.lua index bd1644f..dbbd105 100644 --- a/lua/astrotheme/groups/plugins/beacon.lua +++ b/lua/astrotheme/groups/plugins/beacon.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { Beacon = { bg = C.syntax.blue } } end return callback diff --git a/lua/astrotheme/groups/plugins/bufferline.lua b/lua/astrotheme/groups/plugins/bufferline.lua index 0c088d8..af53b44 100644 --- a/lua/astrotheme/groups/plugins/bufferline.lua +++ b/lua/astrotheme/groups/plugins/bufferline.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { BufferLineBufferVisible = { fg = C.ui.text_inactive, bg = C.ui.base }, diff --git a/lua/astrotheme/groups/plugins/dashboard-nvim.lua b/lua/astrotheme/groups/plugins/dashboard-nvim.lua index e4044df..21735e6 100644 --- a/lua/astrotheme/groups/plugins/dashboard-nvim.lua +++ b/lua/astrotheme/groups/plugins/dashboard-nvim.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { DashboardHeader = { fg = C.syntax.cyan }, diff --git a/lua/astrotheme/groups/plugins/flash.lua b/lua/astrotheme/groups/plugins/flash.lua index a15b221..413d72c 100644 --- a/lua/astrotheme/groups/plugins/flash.lua +++ b/lua/astrotheme/groups/plugins/flash.lua @@ -1,4 +1,5 @@ -- this is a test to see what i like +---@type AstroThemeCallback local function callback() return { FlashBackdrop = { fg = C.syntax.mute }, diff --git a/lua/astrotheme/groups/plugins/gitsigns.lua b/lua/astrotheme/groups/plugins/gitsigns.lua index c4a0ae8..fe2be97 100644 --- a/lua/astrotheme/groups/plugins/gitsigns.lua +++ b/lua/astrotheme/groups/plugins/gitsigns.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { GitSignsAdd = { fg = C.ui.green, bg = C.none }, diff --git a/lua/astrotheme/groups/plugins/hop.lua b/lua/astrotheme/groups/plugins/hop.lua index 1cdf6c4..ac68a18 100644 --- a/lua/astrotheme/groups/plugins/hop.lua +++ b/lua/astrotheme/groups/plugins/hop.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { HopNextKey = { fg = C.ui.red, bold = true }, diff --git a/lua/astrotheme/groups/plugins/indent-blankline.lua b/lua/astrotheme/groups/plugins/indent-blankline.lua index 2a5964a..16755c5 100644 --- a/lua/astrotheme/groups/plugins/indent-blankline.lua +++ b/lua/astrotheme/groups/plugins/indent-blankline.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { IndentBlanklineChar = { fg = C.ui.none_text }, diff --git a/lua/astrotheme/groups/plugins/lazy.lua b/lua/astrotheme/groups/plugins/lazy.lua index 3cceaf8..6fd2cc5 100644 --- a/lua/astrotheme/groups/plugins/lazy.lua +++ b/lua/astrotheme/groups/plugins/lazy.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { LazyH1 = { fg = C.ui.base, bg = C.ui.accent, bold = true }, -- home button diff --git a/lua/astrotheme/groups/plugins/lightspeed.lua b/lua/astrotheme/groups/plugins/lightspeed.lua index 3f5948a..138b10a 100644 --- a/lua/astrotheme/groups/plugins/lightspeed.lua +++ b/lua/astrotheme/groups/plugins/lightspeed.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { LightspeedLabel = { fg = C.ui.red, underline = true }, diff --git a/lua/astrotheme/groups/plugins/mason.lua b/lua/astrotheme/groups/plugins/mason.lua index 9779a84..29ba8db 100644 --- a/lua/astrotheme/groups/plugins/mason.lua +++ b/lua/astrotheme/groups/plugins/mason.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { MasonNormal = { link = "NormalFloat" }, diff --git a/lua/astrotheme/groups/plugins/ministarter.lua b/lua/astrotheme/groups/plugins/ministarter.lua index c1cea1a..1d1f709 100644 --- a/lua/astrotheme/groups/plugins/ministarter.lua +++ b/lua/astrotheme/groups/plugins/ministarter.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { MiniStarterItem = { fg = C.ui.text }, diff --git a/lua/astrotheme/groups/plugins/neo-tree.lua b/lua/astrotheme/groups/plugins/neo-tree.lua index e17ef7c..2142295 100644 --- a/lua/astrotheme/groups/plugins/neo-tree.lua +++ b/lua/astrotheme/groups/plugins/neo-tree.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) return { NeoTreeDirectoryIcon = { fg = C.ui.blue }, diff --git a/lua/astrotheme/groups/plugins/neogit.lua b/lua/astrotheme/groups/plugins/neogit.lua index f3f9248..907a505 100644 --- a/lua/astrotheme/groups/plugins/neogit.lua +++ b/lua/astrotheme/groups/plugins/neogit.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { NeogitDiffDelete = { diff --git a/lua/astrotheme/groups/plugins/noice.lua b/lua/astrotheme/groups/plugins/noice.lua index c0b9ac5..5330816 100644 --- a/lua/astrotheme/groups/plugins/noice.lua +++ b/lua/astrotheme/groups/plugins/noice.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { NoiceCursor = { link = "Cursor" }, diff --git a/lua/astrotheme/groups/plugins/nvim-cmp.lua b/lua/astrotheme/groups/plugins/nvim-cmp.lua index 36610ec..ce0469d 100644 --- a/lua/astrotheme/groups/plugins/nvim-cmp.lua +++ b/lua/astrotheme/groups/plugins/nvim-cmp.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { CmpItemAbbr = { fg = C.ui.text }, diff --git a/lua/astrotheme/groups/plugins/nvim-dap-ui.lua b/lua/astrotheme/groups/plugins/nvim-dap-ui.lua index 68d81bf..dbddaf7 100644 --- a/lua/astrotheme/groups/plugins/nvim-dap-ui.lua +++ b/lua/astrotheme/groups/plugins/nvim-dap-ui.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { DapUIVariable = { link = "Identifier" }, diff --git a/lua/astrotheme/groups/plugins/nvim-notify.lua b/lua/astrotheme/groups/plugins/nvim-notify.lua index 0b78f1d..b0efcaa 100644 --- a/lua/astrotheme/groups/plugins/nvim-notify.lua +++ b/lua/astrotheme/groups/plugins/nvim-notify.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) local bg = (opts.transparent and C.none) or C.ui.tool diff --git a/lua/astrotheme/groups/plugins/nvim-tree.lua b/lua/astrotheme/groups/plugins/nvim-tree.lua index 8b5f55a..09ef66b 100644 --- a/lua/astrotheme/groups/plugins/nvim-tree.lua +++ b/lua/astrotheme/groups/plugins/nvim-tree.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { NvimTreeFolderIcon = { fg = C.syntax.blue }, diff --git a/lua/astrotheme/groups/plugins/nvim-treesitter.lua b/lua/astrotheme/groups/plugins/nvim-treesitter.lua index cc8761b..6529529 100644 --- a/lua/astrotheme/groups/plugins/nvim-treesitter.lua +++ b/lua/astrotheme/groups/plugins/nvim-treesitter.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) return { diff --git a/lua/astrotheme/groups/plugins/nvim-ts-rainbow.lua b/lua/astrotheme/groups/plugins/nvim-ts-rainbow.lua index 70498a7..8e94f58 100644 --- a/lua/astrotheme/groups/plugins/nvim-ts-rainbow.lua +++ b/lua/astrotheme/groups/plugins/nvim-ts-rainbow.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { rainbowcol1 = { fg = "Gold" }, diff --git a/lua/astrotheme/groups/plugins/nvim-ts-rainbow2.lua b/lua/astrotheme/groups/plugins/nvim-ts-rainbow2.lua index b322573..e02f670 100644 --- a/lua/astrotheme/groups/plugins/nvim-ts-rainbow2.lua +++ b/lua/astrotheme/groups/plugins/nvim-ts-rainbow2.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { TSRainbowRed = { fg = C.syntax.red }, diff --git a/lua/astrotheme/groups/plugins/nvim-web-devicons.lua b/lua/astrotheme/groups/plugins/nvim-web-devicons.lua index 9481a20..1c9cb5c 100644 --- a/lua/astrotheme/groups/plugins/nvim-web-devicons.lua +++ b/lua/astrotheme/groups/plugins/nvim-web-devicons.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { DevIconC = { fg = C.icon.c }, diff --git a/lua/astrotheme/groups/plugins/nvim-window-picker.lua b/lua/astrotheme/groups/plugins/nvim-window-picker.lua index 4771ae4..4a0581b 100644 --- a/lua/astrotheme/groups/plugins/nvim-window-picker.lua +++ b/lua/astrotheme/groups/plugins/nvim-window-picker.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { WindowPickerStatusLine = { fg = C.ui.red, bg = C.none }, diff --git a/lua/astrotheme/groups/plugins/rainbow-delimiters.lua b/lua/astrotheme/groups/plugins/rainbow-delimiters.lua index b0ea92b..467f501 100644 --- a/lua/astrotheme/groups/plugins/rainbow-delimiters.lua +++ b/lua/astrotheme/groups/plugins/rainbow-delimiters.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { RainbowDelimiterRed = { fg = C.syntax.red }, diff --git a/lua/astrotheme/groups/plugins/spotlight.lua b/lua/astrotheme/groups/plugins/spotlight.lua index ba36439..6131831 100644 --- a/lua/astrotheme/groups/plugins/spotlight.lua +++ b/lua/astrotheme/groups/plugins/spotlight.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) local bg = (opts.float and C.ui.base) or (opts.transparent and C.none) or C.ui.base local blend = vim.o.winblend or 0 diff --git a/lua/astrotheme/groups/plugins/symbols-outline.lua b/lua/astrotheme/groups/plugins/symbols-outline.lua index 5ffc90b..34056ec 100644 --- a/lua/astrotheme/groups/plugins/symbols-outline.lua +++ b/lua/astrotheme/groups/plugins/symbols-outline.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { FocusedSymbol = { fg = C.ui.yellow, bg = C.none } } end return callback diff --git a/lua/astrotheme/groups/plugins/telescope.lua b/lua/astrotheme/groups/plugins/telescope.lua index 60dce31..0e1f1df 100644 --- a/lua/astrotheme/groups/plugins/telescope.lua +++ b/lua/astrotheme/groups/plugins/telescope.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback(opts) local title = { fg = (opts.title_invert and C.ui.float) or C.ui.title, diff --git a/lua/astrotheme/groups/plugins/vimwiki.lua b/lua/astrotheme/groups/plugins/vimwiki.lua index 55d5946..41d9148 100644 --- a/lua/astrotheme/groups/plugins/vimwiki.lua +++ b/lua/astrotheme/groups/plugins/vimwiki.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { VimwikiLink = { fg = C.syntax.cyan, bg = C.none }, diff --git a/lua/astrotheme/groups/plugins/which-key.lua b/lua/astrotheme/groups/plugins/which-key.lua index 4f80c90..3ab9900 100644 --- a/lua/astrotheme/groups/plugins/which-key.lua +++ b/lua/astrotheme/groups/plugins/which-key.lua @@ -1,3 +1,4 @@ +---@type AstroThemeCallback local function callback() return { WhichKey = { fg = C.ui.cyan }, diff --git a/lua/astrotheme/groups/syntax.lua b/lua/astrotheme/groups/syntax.lua index caab493..0e1c4c3 100644 --- a/lua/astrotheme/groups/syntax.lua +++ b/lua/astrotheme/groups/syntax.lua @@ -8,6 +8,7 @@ -- - Character (Subgroup) -- -- Ref: :help group-name +---@type AstroThemeCallback local function callback(opts) return { -- Comment diff --git a/lua/astrotheme/init.lua b/lua/astrotheme/init.lua index aaa38da..cf6d8cf 100644 --- a/lua/astrotheme/init.lua +++ b/lua/astrotheme/init.lua @@ -3,6 +3,8 @@ local util = require "astrotheme.lib.util" local M = { config = {} } +--- Load a specific theme given a palette name +---@param theme string? function M.load(theme) if not theme @@ -32,6 +34,8 @@ function M.load(theme) if M.config.terminal_colors then util.set_terminal_colors() end end +--- Set up AstroTheme with provided user configured options +---@param opts AstroThemeOpts function M.setup(opts) M.config = require("astrotheme.lib.config").user_config(opts) M.config.plugins = util.get_plugin_list(M.config) diff --git a/lua/astrotheme/lib/config.lua b/lua/astrotheme/lib/config.lua index 20f8b84..3176467 100644 --- a/lua/astrotheme/lib/config.lua +++ b/lua/astrotheme/lib/config.lua @@ -1,5 +1,6 @@ M = {} +---@type AstroThemeOpts M.default = { palette = "astrodark", termguicolors = true, @@ -35,6 +36,12 @@ M.default = { plugins = {}, } -function M.user_config(opts) return vim.tbl_deep_extend("force", M.default, opts or {}) end +---@param opts AstroThemeOpts +---@return AstroThemeOpts +function M.user_config(opts) + local new_config = vim.tbl_deep_extend("force", M.default, opts or {}) + ---@cast new_config AstroThemeOpts + return new_config +end return M diff --git a/lua/astrotheme/lib/util.lua b/lua/astrotheme/lib/util.lua index 88dda7a..66f9a94 100644 --- a/lua/astrotheme/lib/util.lua +++ b/lua/astrotheme/lib/util.lua @@ -1,5 +1,8 @@ local M = {} +--- Reload a given theme +---@param opts AstroThemeOpts +---@param theme string function M.reload(opts, theme) if vim.g.colors_name then vim.cmd.highlight "clear" end if vim.fn.exists "syntax_on" then vim.cmd.syntax "reset" end @@ -7,12 +10,19 @@ function M.reload(opts, theme) vim.g.colors_name = theme end +--- Reload a module +---@param module string +---@param bool boolean +---@return any function M.reload_module(module, bool) bool = bool or false if bool then package.loaded[module] = nil end return require(module) end +--- Retrieve a list of all plugins to enable +---@param opts AstroThemeOpts +---@return string[] function M.get_plugin_list(opts) local lazy_avail, lazy_config = pcall(require, "lazy.core.config") local installed_plugins = lazy_avail and lazy_config.plugins or packer_plugins @@ -20,6 +30,7 @@ function M.get_plugin_list(opts) local plugins = {} for plugin, module in pairs(require "astrotheme.groups.plugins") do + ---@type "auto"|boolean local load = opts.plugins[plugin] if load == nil then load = opts.plugin_default end if load == "auto" then @@ -36,24 +47,41 @@ function M.get_plugin_list(opts) return plugins end +--- Compile all highlights from a list of modules +---@param highlights AstroThemeHighlights +---@param path string +---@param modules string[] +---@param opts AstroThemeOpts +---@return AstroThemeHighlights function M.get_hl_modules(highlights, path, modules, opts) for _, module in ipairs(modules) do if opts.dev then package.loaded[path .. "." .. module] = nil end local file_avail, file = pcall(require, path .. "." .. module) if type(file) == "function" then file = file(opts.style) end + ---@diagnostic disable-next-line: cast-local-type if file_avail then highlights = vim.tbl_deep_extend("force", file, highlights) end end + ---@cast highlights AstroThemeHighlights return highlights end +--- Set a palette given a AstroTheme options +---@param opts AstroThemeOpts +---@return AstroThemePalette function M.set_palettes(opts) local palette_name = "astrotheme.palettes." .. opts.palette if opts.dev then package.loaded[palette_name] = nil end local palette = require(palette_name) palette = vim.tbl_deep_extend("force", palette, opts.palettes.global) - return vim.tbl_deep_extend("force", palette, opts.palettes[opts.palette]) + palette = vim.tbl_deep_extend("force", palette, opts.palettes[opts.palette]) + ---@cast palette AstroThemePalette + return palette end +--- Set highlights in Neovim +---@param opts AstroThemeOpts +---@param highlights AstroThemeHighlights +---@param theme string function M.set_highlights(opts, highlights, theme) local global_hl = opts.highlights.global local theme_hl = opts.highlights[theme] @@ -61,14 +89,17 @@ function M.set_highlights(opts, highlights, theme) pcall(global_hl.modify_hl_groups, highlights, C) pcall(theme_hl.modify_hl_groups, highlights, C) + ---@diagnostic disable-next-line: cast-local-type highlights = vim.tbl_deep_extend("force", highlights, global_hl, theme_hl) - + ---@cast highlights -nil for name, value in pairs(highlights) do -- TODO: optimise in V3 by removing checks. if name ~= "modify_hl_groups" then vim.api.nvim_set_hl(0, name, value) end end end +--- Enable live reloading of AstroTheme for development +---@param opts AstroThemeOpts function M.live_reloading(opts) if opts.dev then vim.api.nvim_create_augroup("AstroTheme", { clear = true }) @@ -88,6 +119,7 @@ function M.live_reloading(opts) end end +--- Set terminal colors based on the currently loaded colors function M.set_terminal_colors() vim.g.terminal_color_0 = C.term.black vim.g.terminal_color_8 = C.term.bright_black diff --git a/lua/astrotheme/palettes/astrodark.lua b/lua/astrotheme/palettes/astrodark.lua index de8d66f..c44008e 100644 --- a/lua/astrotheme/palettes/astrodark.lua +++ b/lua/astrotheme/palettes/astrodark.lua @@ -1,3 +1,4 @@ +---@class AstroThemePalette local c = { none = "NONE", syntax = {}, diff --git a/lua/astrotheme/palettes/astrolight.lua b/lua/astrotheme/palettes/astrolight.lua index bf92d8d..b4751e5 100644 --- a/lua/astrotheme/palettes/astrolight.lua +++ b/lua/astrotheme/palettes/astrolight.lua @@ -1,3 +1,4 @@ +---@class AstroThemePalette local c = { none = "NONE", syntax = {}, diff --git a/lua/astrotheme/palettes/astromars.lua b/lua/astrotheme/palettes/astromars.lua index ac2f081..7287a7f 100644 --- a/lua/astrotheme/palettes/astromars.lua +++ b/lua/astrotheme/palettes/astromars.lua @@ -1,3 +1,4 @@ +---@class AstroThemePalette local c = { none = "NONE", syntax = {}, diff --git a/lua/astrotheme/types.lua b/lua/astrotheme/types.lua new file mode 100644 index 0000000..4c61222 --- /dev/null +++ b/lua/astrotheme/types.lua @@ -0,0 +1,105 @@ +--- AstroTheme Types + +---@alias AstroThemeColor string +---@alias AstroThemeHighlight vim.api.keyset.highlight +---@alias AstroThemeHighlights table +---@alias AstroThemeCallback fun(opts: AstroThemeStyleOpts?): AstroThemeHighlights + +---@class AstroThemePaletteUI +---@field red AstroThemeColor? +---@field orange AstroThemeColor? +---@field yellow AstroThemeColor? +---@field green AstroThemeColor? +---@field cyan AstroThemeColor? +---@field blue AstroThemeColor? +---@field purple AstroThemeColor? +---@field accent AstroThemeColor? +---@field tabline AstroThemeColor? +---@field winbar AstroThemeColor? +---@field tool AstroThemeColor? +---@field base AstroThemeColor? +---@field inactive_base AstroThemeColor? +---@field statusline AstroThemeColor? +---@field split AstroThemeColor? +---@field float AstroThemeColor? +---@field title AstroThemeColor? +---@field border AstroThemeColor? +---@field current_line AstroThemeColor? +---@field scrollbar AstroThemeColor? +---@field selection AstroThemeColor? +---@field menu_selection AstroThemeColor? +---@field highlight AstroThemeColor? +---@field none_text AstroThemeColor? +---@field text AstroThemeColor? +---@field text_active AstroThemeColor? +---@field text_inactive AstroThemeColor? +---@field text_match AstroThemeColor? +---@field prompt AstroThemeColor? + +---@class AstroThemePaletteSyntax +---@field red AstroThemeColor? +---@field orange AstroThemeColor? +---@field yellow AstroThemeColor? +---@field green AstroThemeColor? +---@field cyan AstroThemeColor? +---@field blue AstroThemeColor? +---@field purple AstroThemeColor? +---@field text AstroThemeColor? +---@field comment AstroThemeColor? +---@field mute AstroThemeColor? + +---@class AstroThemePaletteTerm +---@field background AstroThemeColor? +---@field foreground AstroThemeColor? +---@field black AstroThemeColor? +---@field bright_black AstroThemeColor? +---@field red AstroThemeColor? +---@field bright_red AstroThemeColor? +---@field green AstroThemeColor? +---@field bright_green AstroThemeColor? +---@field yellow AstroThemeColor? +---@field bright_yellow AstroThemeColor? +---@field blue AstroThemeColor? +---@field bright_blue AstroThemeColor? +---@field purple AstroThemeColor? +---@field bright_purple AstroThemeColor? +---@field cyan AstroThemeColor? +---@field bright_cyan AstroThemeColor? +---@field white AstroThemeColor? +---@field bright_white AstroThemeColor? + +---@class AstroThemePalette +---@field icon table? Colors for filetype icons +---@field syntax AstroThemePaletteSyntax? Colors that control syntax related highlight groups +---@field term AstroThemePaletteTerm? Colors that control colors set for in-editor terminals +---@field ui AstroThemePaletteUI? Colors that are used throughout the general user interface + +---@class AstroThemeHighlightOpts +---@field modify_hl_groups fun(hl: AstroThemeHighlights, c: AstroThemePalette)? Function for fine control over highlight setting. The first parameter is the table of highlights to modify directly, the second is the current palette of colors +---@field [string] AstroThemeHighlight? Set any string to a highlight definition where the string is the highlight group name + +---@class AstroThemeBackgroundOpts +---@field dark string The palette to use when `background` is set to dark +---@field light string The palette to use when `background` is set to light + +---@class AstroThemeStyleOpts +---@field border boolean? Toggles borders in the user interface +---@field float boolean? Toggles the background color of floating windows +---@field inactive boolean? Toggles dimming inactive windows +---@field italic_comments boolean? Toggles italic comments +---@field neotree boolean? Toggles the neo-tree background color +---@field simple_syntax_colors boolean? Decrease the number of colors used for syntax highlighting +---@field title_invert boolean? Swaps the text and background colors for window titles +---@field transparent boolean? toggle transparency + +---@class AstroThemeOpts +---@field background AstroThemeBackgroundOpts? Set the default palette for dark/light background +---@field dev boolean? Enable development mode (EXPERIMENTAL and not for general use) +---@field highlights table? Configure highlight groups set for a given palette +---@field palettes table? Configure colors for specific palettes or globally +---@field palette string? The default palette to use when setting the colorscheme to astrotheme +---@field plugin_default "auto"|true|false? Sets the default behavior for loading plugins, true/false to enable or disable completely or "auto" to detect if a plugin is available and automatically enable it +---@field plugins table? Allows of rindividual plugin enabling and disabling, takes precedence over the default +---@field style AstroThemeStyleOpts? General style toggles for common style changes +---@field termguicolors boolean? Toggle whether or not AstroTheme sets `termguicolors` +---@field terminal_colors boolean? Toggle whether or not to set colorscheme for in-editor terminals