-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigs.lua
88 lines (72 loc) · 2.48 KB
/
configs.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
local M = {}
--- @alias colorbox.Options table<any, any>
--- @type colorbox.Options
local Defaults = {
-- builtin policy
--- @alias colorbox.BuiltinPolicyConfig "shuffle"|"in_order"|"reverse_order"|"single"
---
-- by filetype policy: buffer filetype => color name
--- @alias colorbox.ByFileTypePolicyConfig {mapping:table<string, string>,empty:string?,fallback:string?}
---
-- fixed interval seconds
--- @alias colorbox.FixedIntervalPolicyConfig {seconds:integer,implement:colorbox.BuiltinPolicyConfig}
---
--- @alias colorbox.PolicyConfig colorbox.BuiltinPolicyConfig|colorbox.ByFileTypePolicyConfig|colorbox.FixedIntervalPolicyConfig
--- @type colorbox.PolicyConfig
policy = "shuffle",
--- @type "startup"|"interval"|"filetype"
timing = "startup",
-- (Optional) filters that disable some colors that you don't want.
--
-- builtin filter
--- @alias colorbox.BuiltinFilterConfig "primary"
---
-- function-based filter, enabled if function returns true.
--- @alias colorbox.FunctionFilterConfig fun(color:string, spec:colorbox.ColorSpec):boolean
---
-- list-based all of filter, a color is enabled if all of inside filters returns true.
--- @alias colorbox.AllFilterConfig (colorbox.BuiltinFilterConfig|colorbox.FunctionFilterConfig)[]
---
--- @alias colorbox.FilterConfig colorbox.BuiltinFilterConfig|colorbox.FunctionFilterConfig|colorbox.AllFilterConfig
--- @type colorbox.FilterConfig?
filter = "primary",
--- @type table<string, function>
setup = {},
--- @type "dark"|"light"|nil
background = nil,
--- @type colorbox.Options
command = {
name = "Colorbox",
desc = "Colorschemes player controller",
},
-- (Optional) hook lua function after colorscheme is been choose.
--- @type function(color_name: string, color_spec: colorbox.ColorSpec):nil|nil
post_hook = nil,
--- @type string
cache_dir = string.format("%s/colorbox.nvim", vim.fn.stdpath("data")),
-- enable debug
debug = false,
-- print log to console (command line)
console_log = true,
-- print log to file.
file_log = false,
}
--- @type colorbox.Options
local Configs = {}
--- @param opts colorbox.Options?
--- @return colorbox.Options
M.setup = function(opts)
Configs = vim.tbl_deep_extend("force", vim.deepcopy(Defaults), opts or {})
return Configs
end
--- @return colorbox.Options
M.get = function()
return Configs
end
--- @param confs colorbox.Options
--- @return colorbox.Options
M.set = function(confs)
Configs = confs
return Configs
end
return M