forked from projekt0n/github-nvim-theme
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
189 lines (162 loc) · 5.23 KB
/
config.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
local collect = require('github-theme.lib.collect')
local util = require('github-theme.util')
local M = { theme = 'github_dark', has_options = false }
-- TODO: improve type of `specs` and `palettes`
---@class (exact) GhTheme.Config
---@field options? GhTheme.Config.Options
---@field palettes? table
---@field specs? table
---@field groups? table<GhTheme.Theme|"all", table<string, GhTheme.HighlightGroup>>
---@class (exact) GhTheme.Config.Module
---@field enable? boolean whether to set plugin-specific highlights for this module/plugin
---@class (exact) GhTheme.Config.Module.Coc: GhTheme.Config.Module
---@field background? boolean whether to set background color of virtual text
---@class (exact) GhTheme.Config.Module.Diagnostic: GhTheme.Config.Module
---@field background? boolean whether to set background color of virtual text
---@class (exact) GhTheme.Config.Module.NativeLSP: GhTheme.Config.Module
---@field background? boolean whether to set background color of virtual text
---Config for external modules/plugins.
---@class (exact) GhTheme.Config.Options.Modules
---@field cmp? boolean|GhTheme.Config.Module
---@field coc? boolean|GhTheme.Config.Module.Coc
---@field coc_explorer? boolean|GhTheme.Config.Module
---@field dapui? boolean|GhTheme.Config.Module
---@field diffchar? boolean|GhTheme.Config.Module
---@field dashboard? boolean|GhTheme.Config.Module
---@field diagnostic? boolean|GhTheme.Config.Module.Diagnostic
---@field fidget? boolean|GhTheme.Config.Module
---@field fzf? boolean|GhTheme.Config.Module
---@field gitgutter? boolean|GhTheme.Config.Module
---@field gitsigns? boolean|GhTheme.Config.Module
---@field indent_blankline? boolean|GhTheme.Config.Module
---@field lsp_semantic_tokens? boolean|GhTheme.Config.Module
---@field lsp_trouble? boolean|GhTheme.Config.Module
---@field mini? boolean|GhTheme.Config.Module
---@field native_lsp? boolean|GhTheme.Config.Module.NativeLSP
---@field neogit? boolean|GhTheme.Config.Module
---@field neotree? boolean|GhTheme.Config.Module
---@field notify? boolean|GhTheme.Config.Module
---@field nvimtree? boolean|GhTheme.Config.Module
---@field telescope? boolean|GhTheme.Config.Module
---@field treesitter? boolean|GhTheme.Config.Module
---@field treesitter_context? boolean|GhTheme.Config.Module
---@field whichkey? boolean|GhTheme.Config.Module
---@class GhTheme.Config.Options
local defaults = {
compile_file_suffix = '_compiled',
compile_path = util.join_paths(util.cache_home, 'github-theme'),
hide_end_of_buffer = true,
hide_nc_statusline = true,
transparent = false,
terminal_colors = true,
dim_inactive = false,
module_default = true,
styles = {
---@type GhTheme.HighlightGroup.Style
comments = 'NONE',
---@type GhTheme.HighlightGroup.Style
functions = 'NONE',
---@type GhTheme.HighlightGroup.Style
keywords = 'NONE',
---@type GhTheme.HighlightGroup.Style
variables = 'NONE',
---@type GhTheme.HighlightGroup.Style
conditionals = 'NONE',
---@type GhTheme.HighlightGroup.Style
constants = 'NONE',
---@type GhTheme.HighlightGroup.Style
numbers = 'NONE',
---@type GhTheme.HighlightGroup.Style
operators = 'NONE',
---@type GhTheme.HighlightGroup.Style
strings = 'NONE',
---@type GhTheme.HighlightGroup.Style
types = 'NONE',
},
inverse = {
match_paren = false,
visual = false,
search = false,
},
darken = {
floats = true,
sidebars = {
enable = true,
---List of (filetype or `'terminal'`) whose bg will be darkened.
list = {},
},
},
---@type GhTheme.Config.Options.Modules
modules = {
coc = {
background = true,
},
diagnostic = {
-- This is linked to so much that is needs to be enabled. This is here primarily
-- for the extra options that can be added with modules
enable = true,
background = false,
},
native_lsp = {
enable = util.is_nvim,
background = true,
},
treesitter = util.is_nvim,
lsp_semantic_tokens = util.is_nvim,
},
}
-- The following is done to disallow the addition of any more fields.
---@type GhTheme.Config.Options
---@diagnostic disable-next-line: redefined-local
local defaults = defaults
M.options = collect.deep_copy(defaults)
M.module_names = {
'cmp',
'coc',
'coc_explorer',
'dapui',
'diffchar',
'dashboard',
'diagnostic',
'fidget',
'fzf',
'gitgutter',
'gitsigns',
'indent_blankline',
'lsp_semantic_tokens',
'lsp_trouble',
'mini',
'native_lsp',
'neogit',
'neotree',
'notify',
'nvimtree',
'telescope',
'treesitter',
'treesitter_context',
'whichkey',
}
---@param name GhTheme.Theme
function M.set_theme(name)
M.theme = name
end
---@param opts GhTheme.Config.Options
function M.set_options(opts)
opts = opts or {}
M.options = collect.deep_extend(M.options, opts)
M.has_options = true
end
function M.reset()
M.options = collect.deep_copy(defaults)
end
function M.get_compiled_info(opts)
opts = opts or {}
local output_path = opts.output_path or M.options.compile_path
local file_suffix = opts.file_suffix or M.options.compile_file_suffix
return output_path, util.join_paths(output_path, (opts.theme or M.theme) .. file_suffix)
end
function M.hash()
local hash = require('github-theme.lib.hash')(M.options)
return hash or 0
end
return M