add function annotations to utils

This commit is contained in:
Michael Chris Lopez
2021-11-08 17:47:14 +08:00
parent 75ab2a5d5b
commit 7dc1515116
3 changed files with 18 additions and 2 deletions

View File

@@ -1,5 +1,3 @@
local M = {}
local function concat_config(prefix, suffixes)
local config = {}
for _, suffix in ipairs(suffixes) do
@@ -8,6 +6,11 @@ local function concat_config(prefix, suffixes)
return config
end
local M = {}
--- Get global configuration as a table.
---@param prefix string e.g. "zenbones"
---@param base_bg? string light or dark
function M.get_global_config(prefix, base_bg)
if type(vim.g[prefix]) == "table" then
return vim.g[prefix]
@@ -57,6 +60,11 @@ function M.get_global_config(prefix, base_bg)
end
end
--- Generate a specs given a palette.
---@param p table palette
---@param base_bg string light or dark
---@param opt? table
---@return table
function M.generate(p, base_bg, opt)
return require("zenbones.specs." .. base_bg)(p, opt)
end

View File

@@ -1,5 +1,6 @@
local M = {}
--- Map palette to 16 ansi colors.
---@param p table
---@return table
function M.colors_map(p)
@@ -23,6 +24,7 @@ function M.colors_map(p)
}
end
--- Apply a palette to g:terminal_color_*.
---@param p table
---@return nil
function M.apply_colors(p)

View File

@@ -1,5 +1,7 @@
local M = {}
--- Apply a zenbones colorscheme based on g:colors_name and &background.
---@return nil
function M.apply_colorscheme()
local colors_name = vim.api.nvim_get_var "colors_name"
package.loaded[colors_name] = nil
@@ -8,6 +10,10 @@ function M.apply_colorscheme()
require("zenbones.term").apply_colors(p)
end
--- Auto-fill a palette with the default palette.
---@param p table palette
---@param base_bg? string light or dark
---@return table<string, table> palette
function M.palette_extend(p, base_bg)
local lush = require "lush"
local hsluv = lush.hsluv