gruber-darker.nvim/lua/gruber-darker/config.lua

67 lines
1.2 KiB
Lua
Raw Normal View History

---@alias ItalicType
---|"strings"
---|"comments"
---|"operators"
---|"folds"
2023-03-30 03:50:44 +02:00
---@alias InvertType
---|"signs"
---|"tabline"
---@class GruberDarkerOpts
---@field bold boolean
2023-03-30 03:50:44 +02:00
---@field invert table<InvertType, boolean>
---@field italic table<ItalicType, boolean>
---@field undercurl boolean
---@field underline boolean
---@type GruberDarkerOpts
local DEFAULTS = {
bold = true,
2023-03-30 03:50:44 +02:00
invert = {
2023-03-30 06:13:32 +02:00
signs = false,
2023-03-30 03:50:44 +02:00
tabline = false,
},
italic = {
2023-03-26 16:04:41 +02:00
strings = true,
comments = true,
operators = false,
folds = true,
},
2023-03-30 03:50:44 +02:00
undercurl = true,
underline = true,
}
---@class ConfigMgr
---@field private resolved_opts GruberDarkerOpts
local ConfigMgr = {}
ConfigMgr.__index = ConfigMgr
---@type ConfigMgr|nil
local instance = nil
---Get GruberDarker user preferences
---@return GruberDarkerOpts
---@nodiscard
function ConfigMgr.get_opts()
2023-03-26 16:04:41 +02:00
if instance ~= nil then
return instance.resolved_opts
end
2023-03-26 16:04:41 +02:00
return DEFAULTS
end
---Set GruberDarker colorscheme options
---@param opts? GruberDarkerOpts
function ConfigMgr.setup(opts)
if instance ~= nil then
return
end
instance = setmetatable({
resolved_opts = vim.tbl_deep_extend("force", DEFAULTS, opts or {}),
}, ConfigMgr)
end
return ConfigMgr