lua/ansi-colorscheme.lua 40.4 K raw
1
-- Some useful links for making your own colorscheme:
2
--
3
-- https://github.com/chriskempson/base16
4
-- https://colourco.de/
5
-- https://color.adobe.com/create/color-wheel
6
-- http://vrl.cs.brown.edu/color
7
8
local M = {}
9
10
-- This is a bit of syntactic sugar for creating highlight groups.
11
--
12
-- local colorscheme = require('colorscheme')
13
-- local hi = colorscheme.highlight
14
-- hi.Comment = { guifg='#ffffff', guibg='#000000', gui='italic', guisp=nil }
15
-- hi.LspDiagnosticsDefaultError = 'DiagnosticError' -- Link to another group
16
--
17
-- This is equivalent to the following vimscript
18
--
19
-- hi Comment guifg=#ffffff guibg=#000000 gui=italic
20
-- hi! link LspDiagnosticsDefaultError DiagnosticError
21
M.highlight = setmetatable({}, {
22
    __newindex = function(_, hlgroup, args)
23
        if ('string' == type(args)) then
24
            vim.api.nvim_set_hl(0, hlgroup, { link = args })
25
            return
26
        end
27
28
        local ctermfg, ctermbg, cterm = args.ctermfg or nil, args.ctermbg or nil, args.cterm or nil
29
        local val = {}
30
        if ctermfg then val.ctermfg = ctermfg end
31
        if ctermbg then val.ctermbg = ctermbg end
32
        if cterm then
33
            for x in string.gmatch(cterm, '([^,]+)') do
34
                if x ~= "none" then
35
                    val[x] = true
36
                end
37
            end
38
        end
39
        vim.api.nvim_set_hl(0, hlgroup, val)
40
    end
41
})
42
43
function M.with_config(config)
44
    M.config = vim.tbl_extend("force", {
45
        telescope = true,
46
        telescope_borders = false,
47
        indentblankline = true,
48
        notify = true,
49
        ts_rainbow = true,
50
        cmp = true,
51
        illuminate = true,
52
        lsp_semantic = true,
53
        mini_completion = true,
54
        dapui = true,
55
    }, config or M.config or {})
56
end
57
58
--- Creates a base16 colorscheme using the colors specified.
59
--
60
-- Builtin colorschemes can be found in the M.colorschemes table.
61
--
62
-- The default Vim highlight groups (including User[1-9]), highlight groups
63
-- pertaining to Neovim's builtin LSP, and highlight groups pertaining to
64
-- Treesitter will be defined.
65
--
66
-- It's worth noting that many colorschemes will specify language specific
67
-- highlight groups like rubyConstant or pythonInclude. However, I don't do
68
-- that here since these should instead be linked to an existing highlight
69
-- group.
70
--
71
-- @param colors (table) table with keys 'base00', 'base01', 'base02',
72
--   'base03', 'base04', 'base05', 'base06', 'base07', 'base08', 'base09',
73
--   'base0A', 'base0B', 'base0C', 'base0D', 'base0E', 'base0F'. Each key should
74
--   map to a valid 6 digit hex color. If a string is provided, the
75
--   corresponding table specifying the colorscheme will be used.
76
function M.setup(colors, config)
77
    M.with_config(config)
78
79
    if type(colors) == 'string' then
80
        colors = M.colorschemes[colors]
81
    end
82
83
    if vim.fn.exists('syntax_on') then
84
        vim.cmd('syntax reset')
85
    end
86
87
    -- BASE16_THEME in a tmux session cannot be trusted because of how envs in tmux panes work.
88
    local base16_colorscheme = nil
89
    if vim.env.TMUX == nil and vim.env.BASE16_THEME ~= nil then
90
        -- Only trust BASE16_THEME if not inside a tmux pane:
91
        base16_colorscheme = M.colorschemes[vim.env.BASE16_THEME]
92
    end
93
    M.colors                              = colors or base16_colorscheme or
94
        M.colorschemes['schemer-dark']
95
    local hi                              = M.highlight
96
97
    -- Vim editor colors
98
    hi.Normal                             = { ctermfg = M.colors.cterm05, ctermbg =  nil }
99
    hi.Bold                               = { cterm = 'bold' }
100
    hi.Debug                              = { ctermfg = M.colors.cterm08 }
101
    hi.Directory                          = { ctermfg = M.colors.cterm0D }
102
    hi.Error                              = { ctermfg = M.colors.cterm08, ctermbg = nil }
103
    hi.ErrorMsg                           = { ctermfg = M.colors.cterm08, ctermbg = nil }
104
    hi.Exception                          = { ctermfg = M.colors.cterm08, ctermbg = nil }
105
    hi.FoldColumn                         = { ctermfg = M.colors.cterm0C, ctermbg = nil }
106
    hi.Folded                             = { ctermfg = M.colors.cterm03, ctermbg = M.colors.cterm01 }
107
    hi.IncSearch                          = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm09, cterm = 'none' }
108
    hi.Italic                             = { ctermfg = nil, ctermbg = nil, cterm = 'italic' }
109
    hi.Macro                              = { ctermfg = M.colors.cterm08, ctermbg = nil }
110
    hi.MatchParen                         = { ctermfg = nil, ctermbg = M.colors.cterm03 }
111
    hi.ModeMsg                            = { ctermfg = M.colors.cterm0B, ctermbg = nil }
112
    hi.MoreMsg                            = { ctermfg = M.colors.cterm0B, ctermbg = nil }
113
    hi.Question                           = { ctermfg = M.colors.cterm0D, ctermbg = nil }
114
    hi.Search                             = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm0A }
115
    hi.Substitute                         = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm0A, cterm = 'none' }
116
    hi.SpecialKey                         = { ctermfg = M.colors.cterm03, ctermbg = nil }
117
    hi.TooLong                            = { ctermfg = M.colors.cterm08, ctermbg = nil }
118
    hi.Underlined                         = { ctermfg = M.colors.cterm08, ctermbg = nil }
119
    hi.Visual                             = { ctermfg = nil, ctermbg = M.colors.cterm02 }
120
    hi.VisualNOS                          = { ctermfg = M.colors.cterm08, ctermbg = nil }
121
    hi.WarningMsg                         = { ctermfg = M.colors.cterm08, ctermbg = nil }
122
    hi.WildMenu                           = { ctermfg = M.colors.cterm08, ctermbg = M.colors.cterm0A }
123
    hi.Title                              = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
124
    hi.Conceal                            = { ctermfg = M.colors.cterm0D, ctermbg = nil }
125
    hi.Cursor                             = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm05 }
126
    hi.NonText                            = { ctermfg = M.colors.cterm03, ctermbg = nil }
127
    hi.LineNr                             = { ctermfg = M.colors.cterm04, ctermbg = nil }
128
    hi.SignColumn                         = { ctermfg = M.colors.cterm04, ctermbg = nil }
129
    hi.StatusLine                         = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm02, cterm = 'none' }
130
    hi.StatusLineNC                       = { ctermfg = M.colors.cterm04, ctermbg = M.colors.cterm01, cterm = 'none' }
131
    hi.WinBar                             = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
132
    hi.WinBarNC                           = { ctermfg = M.colors.cterm04, ctermbg = nil, cterm = 'none' }
133
    hi.VertSplit                          = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
134
    hi.ColorColumn                        = { ctermfg = nil, ctermbg = M.colors.cterm01, cterm = 'none' }
135
    hi.CursorColumn                       = { ctermfg = nil, ctermbg = M.colors.cterm01, cterm = 'none' }
136
    hi.CursorLine                         = { ctermfg = nil, ctermbg = M.colors.cterm01, cterm = 'none' }
137
    hi.CursorLineNr                       = { ctermfg = M.colors.cterm04, ctermbg = M.colors.cterm01 }
138
    hi.QuickFixLine                       = { ctermfg = nil, ctermbg = M.colors.cterm01, cterm = 'none' }
139
    hi.PMenu                              = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm01, cterm = 'none' }
140
    hi.PMenuSel                           = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm05 }
141
    hi.TabLine                            = { ctermfg = M.colors.cterm03, ctermbg = M.colors.cterm01, cterm = 'none' }
142
    hi.TabLineFill                        = { ctermfg = M.colors.cterm03, ctermbg = M.colors.cterm01, cterm = 'none' }
143
    hi.TabLineSel                         = { ctermfg = M.colors.cterm0B, ctermbg = M.colors.cterm01, cterm = 'none' }
144
145
    -- Standard syntax highlighting
146
    hi.Boolean                            = { ctermfg = M.colors.cterm09, ctermbg = nil }
147
    hi.Character                          = { ctermfg = M.colors.cterm08, ctermbg = nil }
148
    hi.Comment                            = { ctermfg = M.colors.cterm03, ctermbg = nil }
149
    hi.Conditional                        = { ctermfg = M.colors.cterm0E, ctermbg = nil }
150
    hi.Constant                           = { ctermfg = M.colors.cterm09, ctermbg = nil }
151
    hi.Define                             = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
152
    hi.Delimiter                          = { ctermfg = M.colors.cterm0F, ctermbg = nil }
153
    hi.Float                              = { ctermfg = M.colors.cterm09, ctermbg = nil }
154
    hi.Function                           = { ctermfg = M.colors.cterm0D, ctermbg = nil }
155
    hi.Identifier                         = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
156
    hi.Include                            = { ctermfg = M.colors.cterm0D, ctermbg = nil }
157
    hi.Keyword                            = { ctermfg = M.colors.cterm0E, ctermbg = nil }
158
    hi.Label                              = { ctermfg = M.colors.cterm0A, ctermbg = nil }
159
    hi.Number                             = { ctermfg = M.colors.cterm09, ctermbg = nil }
160
    hi.Operator                           = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
161
    hi.PreProc                            = { ctermfg = M.colors.cterm0A, ctermbg = nil }
162
    hi.Repeat                             = { ctermfg = M.colors.cterm0A, ctermbg = nil }
163
    hi.Special                            = { ctermfg = M.colors.cterm0C, ctermbg = nil }
164
    hi.SpecialChar                        = { ctermfg = M.colors.cterm0F, ctermbg = nil }
165
    hi.Statement                          = { ctermfg = M.colors.cterm08, ctermbg = nil }
166
    hi.StorageClass                       = { ctermfg = M.colors.cterm0A, ctermbg = nil }
167
    hi.String                             = { ctermfg = M.colors.cterm0B, ctermbg = nil }
168
    hi.Structure                          = { ctermfg = M.colors.cterm0E, ctermbg = nil }
169
    hi.Tag                                = { ctermfg = M.colors.cterm0A, ctermbg = nil }
170
    hi.Todo                               = { ctermfg = M.colors.cterm0A, ctermbg = M.colors.cterm01 }
171
    hi.Type                               = { ctermfg = M.colors.cterm0A, ctermbg = nil, cterm = 'none' }
172
    hi.Typedef                            = { ctermfg = M.colors.cterm0A, ctermbg = nil }
173
174
    -- Diff highlighting
175
    hi.DiffAdd                            = { ctermfg = M.colors.cterm0B, ctermbg = nil }
176
    hi.DiffChange                         = { ctermfg = M.colors.cterm03, ctermbg = nil }
177
    hi.DiffDelete                         = { ctermfg = M.colors.cterm08, ctermbg = nil }
178
    hi.DiffText                           = { ctermfg = M.colors.cterm0D, ctermbg = nil }
179
    hi.DiffAdded                          = { ctermfg = M.colors.cterm0B, ctermbg = nil }
180
    hi.DiffFile                           = { ctermfg = M.colors.cterm08, ctermbg = nil }
181
    hi.DiffNewFile                        = { ctermfg = M.colors.cterm0B, ctermbg = nil }
182
    hi.DiffLine                           = { ctermfg = M.colors.cterm0D, ctermbg = nil }
183
    hi.DiffRemoved                        = { ctermfg = M.colors.cterm08, ctermbg = nil }
184
185
    -- Git highlighting
186
    hi.gitcommitOverflow                  = { ctermfg = M.colors.cterm08, ctermbg = nil }
187
    hi.gitcommitSummary                   = { ctermfg = M.colors.cterm0B, ctermbg = nil }
188
    hi.gitcommitComment                   = { ctermfg = M.colors.cterm03, ctermbg = nil }
189
    hi.gitcommitUntracked                 = { ctermfg = M.colors.cterm03, ctermbg = nil }
190
    hi.gitcommitDiscarded                 = { ctermfg = M.colors.cterm03, ctermbg = nil }
191
    hi.gitcommitSelected                  = { ctermfg = M.colors.cterm03, ctermbg = nil }
192
    hi.gitcommitHeader                    = { ctermfg = M.colors.cterm0E, ctermbg = nil }
193
    hi.gitcommitSelectedType              = { ctermfg = M.colors.cterm0D, ctermbg = nil }
194
    hi.gitcommitUnmergedType              = { ctermfg = M.colors.cterm0D, ctermbg = nil }
195
    hi.gitcommitDiscardedType             = { ctermfg = M.colors.cterm0D, ctermbg = nil }
196
    hi.gitcommitBranch                    = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'bold' }
197
    hi.gitcommitUntrackedFile             = { ctermfg = M.colors.cterm0A, ctermbg = nil }
198
    hi.gitcommitUnmergedFile              = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'bold' }
199
    hi.gitcommitDiscardedFile             = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'bold' }
200
    hi.gitcommitSelectedFile              = { ctermfg = M.colors.cterm0B, ctermbg = nil, cterm = 'bold' }
201
202
    -- GitGutter highlighting
203
    hi.GitGutterAdd                       = { ctermfg = M.colors.cterm0B, ctermbg = nil }
204
    hi.GitGutterChange                    = { ctermfg = M.colors.cterm0D, ctermbg = nil }
205
    hi.GitGutterDelete                    = { ctermfg = M.colors.cterm08, ctermbg = nil }
206
    hi.GitGutterChangeDelete              = { ctermfg = M.colors.cterm0E, ctermbg = nil }
207
208
    -- Spelling highlighting
209
    hi.SpellBad                           = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
210
    hi.SpellLocal                         = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
211
    hi.SpellCap                           = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
212
    hi.SpellRare                          = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
213
214
    hi.DiagnosticError                    = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
215
    hi.DiagnosticWarn                     = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
216
    hi.DiagnosticInfo                     = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
217
    hi.DiagnosticHint                     = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
218
    hi.DiagnosticUnderlineError           = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
219
    hi.DiagnosticUnderlineWarning         = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
220
    hi.DiagnosticUnderlineWarn            = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
221
    hi.DiagnosticUnderlineInformation     = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
222
    hi.DiagnosticUnderlineHint            = { ctermfg = nil, ctermbg = nil, cterm = 'undercurl' }
223
224
    hi.LspReferenceText                   = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
225
    hi.LspReferenceRead                   = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
226
    hi.LspReferenceWrite                  = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
227
    hi.LspDiagnosticsDefaultError         = 'DiagnosticError'
228
    hi.LspDiagnosticsDefaultWarning       = 'DiagnosticWarn'
229
    hi.LspDiagnosticsDefaultInformation   = 'DiagnosticInfo'
230
    hi.LspDiagnosticsDefaultHint          = 'DiagnosticHint'
231
    hi.LspDiagnosticsUnderlineError       = 'DiagnosticUnderlineError'
232
    hi.LspDiagnosticsUnderlineWarning     = 'DiagnosticUnderlineWarning'
233
    hi.LspDiagnosticsUnderlineInformation = 'DiagnosticUnderlineInformation'
234
    hi.LspDiagnosticsUnderlineHint        = 'DiagnosticUnderlineHint'
235
236
    hi.TSAnnotation                       = { ctermfg = M.colors.cterm0F, ctermbg = nil, cterm = 'none' }
237
    hi.TSAttribute                        = { ctermfg = M.colors.cterm0A, ctermbg = nil, cterm = 'none' }
238
    hi.TSBoolean                          = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'none' }
239
    hi.TSCharacter                        = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
240
    hi.TSComment                          = { ctermfg = M.colors.cterm03, ctermbg = nil, cterm = 'italic' }
241
    hi.TSConstructor                      = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
242
    hi.TSConditional                      = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
243
    hi.TSConstant                         = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'none' }
244
    hi.TSConstBuiltin                     = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'italic' }
245
    hi.TSConstMacro                       = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
246
    hi.TSError                            = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
247
    hi.TSException                        = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
248
    hi.TSField                            = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
249
    hi.TSFloat                            = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'none' }
250
    hi.TSFunction                         = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
251
    hi.TSFuncBuiltin                      = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'italic' }
252
    hi.TSFuncMacro                        = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
253
    hi.TSInclude                          = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
254
    hi.TSKeyword                          = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
255
    hi.TSKeywordFunction                  = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
256
    hi.TSKeywordOperator                  = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
257
    hi.TSLabel                            = { ctermfg = M.colors.cterm0A, ctermbg = nil, cterm = 'none' }
258
    hi.TSMethod                           = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
259
    hi.TSNamespace                        = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
260
    hi.TSNone                             = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
261
    hi.TSNumber                           = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'none' }
262
    hi.TSOperator                         = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
263
    hi.TSParameter                        = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
264
    hi.TSParameterReference               = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
265
    hi.TSProperty                         = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
266
    hi.TSPunctDelimiter                   = { ctermfg = M.colors.cterm0F, ctermbg = nil, cterm = 'none' }
267
    hi.TSPunctBracket                     = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
268
    hi.TSPunctSpecial                     = { ctermfg = M.colors.cterm0F, ctermbg = nil, cterm = 'none' }
269
    hi.TSRepeat                           = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
270
    hi.TSString                           = { ctermfg = M.colors.cterm0B, ctermbg = nil, cterm = 'none' }
271
    hi.TSStringRegex                      = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
272
    hi.TSStringEscape                     = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
273
    hi.TSSymbol                           = { ctermfg = M.colors.cterm0B, ctermbg = nil, cterm = 'none' }
274
    hi.TSTag                              = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
275
    hi.TSTagDelimiter                     = { ctermfg = M.colors.cterm0F, ctermbg = nil, cterm = 'none' }
276
    hi.TSText                             = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
277
    hi.TSStrong                           = { ctermfg = nil, ctermbg = nil, cterm = 'bold' }
278
    hi.TSEmphasis                         = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'italic' }
279
    hi.TSUnderline                        = { ctermfg = M.colors.cterm00, ctermbg = nil, cterm = 'underline' }
280
    hi.TSStrike                           = { ctermfg = M.colors.cterm00, ctermbg = nil, cterm = 'strikethrough' }
281
    hi.TSTitle                            = { ctermfg = M.colors.cterm0D, ctermbg = nil, cterm = 'none' }
282
    hi.TSLiteral                          = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'none' }
283
    hi.TSURI                              = { ctermfg = M.colors.cterm09, ctermbg = nil, cterm = 'underline' }
284
    hi.TSType                             = { ctermfg = M.colors.cterm0A, ctermbg = nil, cterm = 'none' }
285
    hi.TSTypeBuiltin                      = { ctermfg = M.colors.cterm0A, ctermbg = nil, cterm = 'italic' }
286
    hi.TSVariable                         = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
287
    hi.TSVariableBuiltin                  = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'italic' }
288
289
    hi.TSDefinition                       = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
290
    hi.TSDefinitionUsage                  = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
291
    hi.TSCurrentScope                     = { ctermfg = nil, ctermbg = nil, cterm = 'bold' }
292
293
    hi.LspInlayHint                       = { ctermfg = M.colors.cterm03, ctermbg = nil, cterm = 'italic' }
294
295
    if vim.fn.has('nvim-0.8.0') then
296
        hi['@comment']                  = 'TSComment'
297
        hi['@error']                    = 'TSError'
298
        hi['@none']                     = 'TSNone'
299
        hi['@preproc']                  = 'PreProc'
300
        hi['@define']                   = 'Define'
301
        hi['@operator']                 = 'TSOperator'
302
        hi['@punctuation.delimiter']    = 'TSPunctDelimiter'
303
        hi['@punctuation.bracket']      = 'TSPunctBracket'
304
        hi['@punctuation.special']      = 'TSPunctSpecial'
305
        hi['@string']                   = 'TSString'
306
        hi['@string.regex']             = 'TSStringRegex'
307
        hi['@string.escape']            = 'TSStringEscape'
308
        hi['@string.special']           = 'SpecialChar'
309
        hi['@character']                = 'TSCharacter'
310
        hi['@character.special']        = 'SpecialChar'
311
        hi['@boolean']                  = 'TSBoolean'
312
        hi['@number']                   = 'TSNumber'
313
        hi['@float']                    = 'TSFloat'
314
        hi['@function']                 = 'TSFunction'
315
        hi['@function.call']            = 'TSFunction'
316
        hi['@function.builtin']         = 'TSFuncBuiltin'
317
        hi['@function.macro']           = 'TSFuncMacro'
318
        hi['@method']                   = 'TSMethod'
319
        hi['@method.call']              = 'TSMethod'
320
        hi['@constructor']              = 'TSConstructor'
321
        hi['@parameter']                = 'TSParameter'
322
        hi['@keyword']                  = 'TSKeyword'
323
        hi['@keyword.function']         = 'TSKeywordFunction'
324
        hi['@keyword.operator']         = 'TSKeywordOperator'
325
        hi['@keyword.return']           = 'TSKeyword'
326
        hi['@conditional']              = 'TSConditional'
327
        hi['@repeat']                   = 'TSRepeat'
328
        hi['@debug']                    = 'Debug'
329
        hi['@label']                    = 'TSLabel'
330
        hi['@include']                  = 'TSInclude'
331
        hi['@exception']                = 'TSException'
332
        hi['@type']                     = 'TSType'
333
        hi['@type.builtin']             = 'TSTypeBuiltin'
334
        hi['@type.qualifier']           = 'TSKeyword'
335
        hi['@type.definition']          = 'TSType'
336
        hi['@storageclass']             = 'StorageClass'
337
        hi['@attribute']                = 'TSAttribute'
338
        hi['@field']                    = 'TSField'
339
        hi['@property']                 = 'TSProperty'
340
        hi['@variable']                 = 'TSVariable'
341
        hi['@variable.builtin']         = 'TSVariableBuiltin'
342
        hi['@constant']                 = 'TSConstant'
343
        hi['@constant.builtin']         = 'TSConstant'
344
        hi['@constant.macro']           = 'TSConstant'
345
        hi['@namespace']                = 'TSNamespace'
346
        hi['@symbol']                   = 'TSSymbol'
347
        hi['@text']                     = 'TSText'
348
        hi['@text.diff.add']            = 'DiffAdd'
349
        hi['@text.diff.delete']         = 'DiffDelete'
350
        hi['@text.strong']              = 'TSStrong'
351
        hi['@text.emphasis']            = 'TSEmphasis'
352
        hi['@text.underline']           = 'TSUnderline'
353
        hi['@text.strike']              = 'TSStrike'
354
        hi['@text.title']               = 'TSTitle'
355
        hi['@text.literal']             = 'TSLiteral'
356
        hi['@text.uri']                 = 'TSUri'
357
        hi['@text.math']                = 'Number'
358
        hi['@text.environment']         = 'Macro'
359
        hi['@text.environment.name']    = 'Type'
360
        hi['@text.reference']           = 'TSParameterReference'
361
        hi['@text.todo']                = 'Todo'
362
        hi['@text.note']                = 'Tag'
363
        hi['@text.warning']             = 'DiagnosticWarn'
364
        hi['@text.danger']              = 'DiagnosticError'
365
        hi['@tag']                      = 'TSTag'
366
        hi['@tag.attribute']            = 'TSAttribute'
367
        hi['@tag.delimiter']            = 'TSTagDelimiter'
368
369
        hi['@function.method']          = '@method'
370
        hi['@function.method.call']     = '@method.call'
371
        hi['@comment.error']            = '@text.danger'
372
        hi['@comment.warning']          = '@text.warning'
373
        hi['@comment.hint']             = 'DiagnosticHint'
374
        hi['@comment.info']             = 'DiagnosticInfo'
375
        hi['@comment.todo']             = '@text.todo'
376
        hi['@diff.plus']                = '@text.diff.add'
377
        hi['@diff.minus']               = '@text.diff.delete'
378
        hi['@diff.delta']               = 'DiffChange'
379
        hi['@string.special.url']       = '@text.uri'
380
        hi['@keyword.directive']        = '@preproc'
381
        hi['@keyword.directive.define'] = '@define'
382
        hi['@keyword.storage']          = '@storageclass'
383
        hi['@keyword.conditional']      = '@conditional'
384
        hi['@keyword.debug']            = '@debug'
385
        hi['@keyword.exception']        = '@exception'
386
        hi['@keyword.import']           = '@include'
387
        hi['@keyword.repeat']           = '@repeat'
388
        hi['@variable.parameter']       = '@parameter'
389
        hi['@variable.member']          = '@field'
390
        hi['@module']                   = '@namespace'
391
        hi['@number.float']             = '@float'
392
        hi['@string.special.symbol']    = '@symbol'
393
        hi['@string.regexp']            = '@string.regex'
394
        hi['@markup.strong']            = '@text.strong'
395
        hi['@markup.italic']            = 'Italic'
396
        hi['@markup.link']              = '@text.link'
397
        hi['@markup.strikethrough']     = '@text.strikethrough'
398
        hi['@markup.heading']           = '@text.title'
399
        hi['@markup.raw']               = '@text.literal'
400
        hi['@markup.link']              = '@text.reference'
401
        hi['@markup.link.url']          = '@text.uri'
402
        hi['@markup.link.label']        = '@string.special'
403
        hi['@markup.list']              = '@punctuation.special'
404
    end
405
406
    if M.config.ts_rainbow then
407
        hi.rainbowcol1 = { ctermfg = M.colors.cterm06 }
408
        hi.rainbowcol2 = { ctermfg = M.colors.cterm09  }
409
        hi.rainbowcol3 = { ctermfg = M.colors.cterm0A }
410
        hi.rainbowcol4 = { ctermfg = M.colors.cterm07  }
411
        hi.rainbowcol5 = { ctermfg = M.colors.cterm0C  }
412
        hi.rainbowcol6 = { ctermfg = M.colors.cterm0D  }
413
        hi.rainbowcol7 = { ctermfg = M.colors.cterm0E  }
414
    end
415
416
    hi.NvimInternalError = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm08, cterm = 'none' }
417
418
    hi.NormalFloat       = { ctermfg = M.colors.cterm05, ctermbg = nil }
419
    hi.FloatBorder       = { ctermfg = M.colors.cterm05, ctermbg = nil }
420
    hi.NormalNC          = { ctermfg = M.colors.cterm05, ctermbg = nil }
421
    hi.TermCursor        = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm05, cterm = 'none' }
422
    hi.TermCursorNC      = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm05 }
423
424
    hi.User1             = { ctermfg = M.colors.cterm08, ctermbg = M.colors.cterm02, cterm = 'none' }
425
    hi.User2             = { ctermfg = M.colors.cterm0E, ctermbg = M.colors.cterm02, cterm = 'none' }
426
    hi.User3             = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm02, cterm = 'none' }
427
    hi.User4             = { ctermfg = M.colors.cterm0C, ctermbg = M.colors.cterm02, cterm = 'none' }
428
    hi.User5             = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm02, cterm = 'none' }
429
    hi.User6             = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm01, cterm = 'none' }
430
    hi.User7             = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm02, cterm = 'none' }
431
    hi.User8             = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm02, cterm = 'none' }
432
    hi.User9             = { ctermfg = M.colors.cterm00, ctermbg = M.colors.cterm02, cterm = 'none' }
433
434
    hi.TreesitterContext = { ctermfg = nil, ctermbg = M.colors.cterm01, cterm = 'italic' }
435
436
    if M.config.telescope then
437
        hi.TelescopeBorder       = { ctermfg = M.colors.cterm05, ctermbg = nil }
438
        hi.TelescopePromptBorder = { ctermfg = M.colors.cterm05, ctermbg = nil }
439
        hi.TelescopePromptNormal = { ctermfg = M.colors.cterm05, ctermbg = nil }
440
        hi.TelescopePromptPrefix = { ctermfg = M.colors.cterm05, ctermbg = nil }
441
        hi.TelescopeNormal       = { ctermbg = nil }
442
        hi.TelescopePreviewTitle = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm0B }
443
        hi.TelescopePromptTitle  = { ctermfg = M.colors.cterm01, ctermbg = M.colors.cterm08 }
444
        hi.TelescopeResultsTitle = { ctermfg = M.colors.cterm05, ctermbg = nil }
445
        hi.TelescopeSelection    = { ctermbg = M.colors.cterm01 }
446
        hi.TelescopePreviewLine  = { ctermbg = M.colors.cterm01, cterm = 'none' }
447
    end
448
449
    if M.config.notify then
450
        hi.NotifyERRORBorder = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
451
        hi.NotifyWARNBorder  = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
452
        hi.NotifyINFOBorder  = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
453
        hi.NotifyDEBUGBorder = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
454
        hi.NotifyTRACEBorder = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
455
        hi.NotifyERRORIcon   = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
456
        hi.NotifyWARNIcon    = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
457
        hi.NotifyINFOIcon    = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
458
        hi.NotifyDEBUGIcon   = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
459
        hi.NotifyTRACEIcon   = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
460
        hi.NotifyERRORTitle  = { ctermfg = M.colors.cterm08, ctermbg = nil, cterm = 'none' }
461
        hi.NotifyWARNTitle   = { ctermfg = M.colors.cterm0E, ctermbg = nil, cterm = 'none' }
462
        hi.NotifyINFOTitle   = { ctermfg = M.colors.cterm05, ctermbg = nil, cterm = 'none' }
463
        hi.NotifyDEBUGTitle  = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
464
        hi.NotifyTRACETitle  = { ctermfg = M.colors.cterm0C, ctermbg = nil, cterm = 'none' }
465
        hi.NotifyERRORBody   = 'Normal'
466
        hi.NotifyWARNBody    = 'Normal'
467
        hi.NotifyINFOBody    = 'Normal'
468
        hi.NotifyDEBUGBody   = 'Normal'
469
        hi.NotifyTRACEBody   = 'Normal'
470
    end
471
472
    if M.config.indentblankline then
473
        hi.IndentBlanklineChar        = { ctermfg = M.colors.cterm02, cterm = 'nocombine' }
474
        hi.IndentBlanklineContextChar = { ctermfg = M.colors.cterm04, cterm = 'nocombine' }
475
        hi.IblIndent                  = { ctermfg = M.colors.cterm02, cterm = 'nocombine' }
476
        hi.IblWhitespace              = 'Whitespace'
477
        hi.IblScope                   = { ctermfg = M.colors.cterm04, cterm = 'nocombine' }
478
    end
479
480
    if M.config.cmp then
481
        hi.CmpDocumentationBorder   = { ctermfg = M.colors.cterm05, ctermbg = nil }
482
        hi.CmpDocumentation         = { ctermfg = M.colors.cterm05, ctermbg = nil }
483
        hi.CmpItemAbbr              = { ctermfg = M.colors.cterm05, ctermbg = M.colors.cterm01 }
484
        hi.CmpItemAbbrDeprecated    = { ctermfg = M.colors.cterm03, ctermbg = nil, cterm = 'strikethrough' }
485
        hi.CmpItemAbbrMatch         = { ctermfg = M.colors.cterm0D, ctermbg = nil }
486
        hi.CmpItemAbbrMatchFuzzy    = { ctermfg = M.colors.cterm0D, ctermbg = nil }
487
        hi.CmpItemKindDefault       = { ctermfg = M.colors.cterm05, ctermbg = nil }
488
        hi.CmpItemMenu              = { ctermfg = M.colors.cterm04, ctermbg = nil }
489
        hi.CmpItemKindKeyword       = { ctermfg = M.colors.cterm0E, ctermbg = nil }
490
        hi.CmpItemKindVariable      = { ctermfg = M.colors.cterm08, ctermbg = nil }
491
        hi.CmpItemKindConstant      = { ctermfg = M.colors.cterm09, ctermbg = nil }
492
        hi.CmpItemKindReference     = { ctermfg = M.colors.cterm08, ctermbg = nil }
493
        hi.CmpItemKindValue         = { ctermfg = M.colors.cterm09, ctermbg = nil }
494
        hi.CmpItemKindFunction      = { ctermfg = M.colors.cterm0D, ctermbg = nil }
495
        hi.CmpItemKindMethod        = { ctermfg = M.colors.cterm0D, ctermbg = nil }
496
        hi.CmpItemKindConstructor   = { ctermfg = M.colors.cterm0D, ctermbg = nil }
497
        hi.CmpItemKindClass         = { ctermfg = M.colors.cterm0A, ctermbg = nil }
498
        hi.CmpItemKindInterface     = { ctermfg = M.colors.cterm0A, ctermbg = nil }
499
        hi.CmpItemKindStruct        = { ctermfg = M.colors.cterm0A, ctermbg = nil }
500
        hi.CmpItemKindEvent         = { ctermfg = M.colors.cterm0A, ctermbg = nil }
501
        hi.CmpItemKindEnum          = { ctermfg = M.colors.cterm0A, ctermbg = nil }
502
        hi.CmpItemKindUnit          = { ctermfg = M.colors.cterm0A, ctermbg = nil }
503
        hi.CmpItemKindModule        = { ctermfg = M.colors.cterm05, ctermbg = nil }
504
        hi.CmpItemKindProperty      = { ctermfg = M.colors.cterm08, ctermbg = nil }
505
        hi.CmpItemKindField         = { ctermfg = M.colors.cterm08, ctermbg = nil }
506
        hi.CmpItemKindTypeParameter = { ctermfg = M.colors.cterm0A, ctermbg = nil }
507
        hi.CmpItemKindEnumMember    = { ctermfg = M.colors.cterm0A, ctermbg = nil }
508
        hi.CmpItemKindOperator      = { ctermfg = M.colors.cterm05, ctermbg = nil }
509
        hi.CmpItemKindSnippet       = { ctermfg = M.colors.cterm04, ctermbg = nil }
510
    end
511
512
    if M.config.illuminate then
513
        hi.IlluminatedWordText  = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
514
        hi.IlluminatedWordRead  = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
515
        hi.IlluminatedWordWrite = { ctermfg = nil, ctermbg = nil, cterm = 'underline' }
516
    end
517
518
    if M.config.lsp_semantic then
519
        hi['@class'] = 'TSType'
520
        hi['@struct'] = 'TSType'
521
        hi['@enum'] = 'TSType'
522
        hi['@enumMember'] = 'Constant'
523
        hi['@event'] = 'Identifier'
524
        hi['@interface'] = 'Structure'
525
        hi['@modifier'] = 'Identifier'
526
        hi['@regexp'] = 'TSStringRegex'
527
        hi['@typeParameter'] = 'Type'
528
        hi['@decorator'] = 'Identifier'
529
530
        hi['@lsp.type.namespace'] = '@namespace'
531
        hi['@lsp.type.type'] = '@type'
532
        hi['@lsp.type.class'] = '@type'
533
        hi['@lsp.type.enum'] = '@type'
534
        hi['@lsp.type.interface'] = '@type'
535
        hi['@lsp.type.struct'] = '@type'
536
        hi['@lsp.type.parameter'] = '@parameter'
537
        hi['@lsp.type.variable'] = '@variable'
538
        hi['@lsp.type.property'] = '@property'
539
        hi['@lsp.type.enumMember'] = '@constant'
540
        hi['@lsp.type.function'] = '@function'
541
        hi['@lsp.type.method'] = '@method'
542
        hi['@lsp.type.macro'] = '@function.macro'
543
        hi['@lsp.type.decorator'] = '@function'
544
    end
545
546
    if M.config.mini_completion then
547
        hi.MiniCompletionActiveParameter = 'CursorLine'
548
    end
549
550
    if M.config.dapui then
551
        hi.DapUINormal = 'Normal'
552
        hi.DapUINormal    = "Normal"
553
        hi.DapUIVariable  = "Normal"
554
        hi.DapUIScope     = { ctermfg = M.colors.cterm0D }
555
        hi.DapUIType      = { ctermfg = M.colors.cterm0E }
556
        hi.DapUIValue     = "Normal"
557
        hi.DapUIModifiedValue = { ctermfg = M.colors.cterm0D, cterm = "bold" }
558
        hi.DapUIDecoration = { ctermfg = M.colors.cterm0D }
559
        hi.DapUIThread    = { ctermfg = M.colors.cterm0B }
560
        hi.DapUIStoppedThread = { ctermfg = M.colors.cterm0D }
561
        hi.DapUIFrameName = "Normal"
562
        hi.DapUISource    = { ctermfg = M.colors.cterm0E }
563
        hi.DapUILineNumber = { ctermfg = M.colors.cterm0D }
564
        hi.DapUIFloatNormal = "NormalFloat"
565
        hi.DapUIFloatBorder = { ctermfg = M.colors.cterm0D }
566
        hi.DapUIWatchesEmpty = { ctermfg = M.colors.cterm08 }
567
        hi.DapUIWatchesValue = { ctermfg = M.colors.cterm0B }
568
        hi.DapUIWatchesError = { ctermfg = M.colors.cterm08 }
569
        hi.DapUIBreakpointsPath = { ctermfg = M.colors.cterm0D }
570
        hi.DapUIBreakpointsInfo = { ctermfg = M.colors.cterm0B }
571
        hi.DapUIBreakpointsCurrentLine = { ctermfg = M.colors.cterm0B, cterm = "bold" }
572
        hi.DapUIBreakpointsLine = "DapUILineNumber"
573
        hi.DapUIBreakpointsDisabledLine = { ctermfg = M.colors.cterm02 }
574
        hi.DapUICurrentFrameName = "DapUIBreakpointsCurrentLine"
575
        hi.DapUIStepOver  = { ctermfg = M.colors.cterm0D }
576
        hi.DapUIStepInto  = { ctermfg = M.colors.cterm0D }
577
        hi.DapUIStepBack  = { ctermfg = M.colors.cterm0D }
578
        hi.DapUIStepOut   = { ctermfg = M.colors.cterm0D }
579
        hi.DapUIStop      = { ctermfg = M.colors.cterm08 }
580
        hi.DapUIPlayPause = { ctermfg = M.colors.cterm0B }
581
        hi.DapUIRestart   = { ctermfg = M.colors.cterm0B }
582
        hi.DapUIUnavailable = { ctermfg = M.colors.cterm02 }
583
        hi.DapUIWinSelect = { ctermfg = M.colors.cterm0D, cterm = "bold" }
584
        hi.DapUIEndofBuffer = "EndOfBuffer"
585
        hi.DapUINormalNC  = "Normal"
586
        hi.DapUIPlayPauseNC = { ctermfg = M.colors.cterm0B }
587
        hi.DapUIRestartNC = { ctermfg = M.colors.cterm0B }
588
        hi.DapUIStopNC    = { ctermfg = M.colors.cterm08 }
589
        hi.DapUIUnavailableNC = { ctermfg = M.colors.cterm02 }
590
        hi.DapUIStepOverNC = { ctermfg = M.colors.cterm0D }
591
        hi.DapUIStepIntoNC = { ctermfg = M.colors.cterm0D }
592
        hi.DapUIStepBackNC = { ctermfg = M.colors.cterm0D }
593
        hi.DapUIStepOutNC = { ctermfg = M.colors.cterm0D }
594
    end
595
596
597
    vim.g.terminal_color_0  = M.colors.cterm00
598
    vim.g.terminal_color_1  = M.colors.cterm08
599
    vim.g.terminal_color_2  = M.colors.cterm0B
600
    vim.g.terminal_color_3  = M.colors.cterm0A
601
    vim.g.terminal_color_4  = M.colors.cterm0D
602
    vim.g.terminal_color_5  = M.colors.cterm0E
603
    vim.g.terminal_color_6  = M.colors.cterm0C
604
    vim.g.terminal_color_7  = M.colors.cterm05
605
    vim.g.terminal_color_8  = M.colors.cterm03
606
    vim.g.terminal_color_9  = M.colors.cterm08
607
    vim.g.terminal_color_10 = M.colors.cterm0B
608
    vim.g.terminal_color_11 = M.colors.cterm0A
609
    vim.g.terminal_color_12 = M.colors.cterm0D
610
    vim.g.terminal_color_13 = M.colors.cterm0E
611
    vim.g.terminal_color_14 = M.colors.cterm0C
612
    vim.g.terminal_color_15 = M.colors.cterm07
613
614
end
615
616
function M.available_colorschemes()
617
    return vim.tbl_keys(M.colorschemes)
618
end
619
620
M.colorschemes = {}
621
setmetatable(M.colorschemes, {
622
    __index = function(t, key)
623
        t[key] = require(string.format('colors.%s', key))
624
        return t[key]
625
    end,
626
})
627
628
-- Default ANSI colorscheme mapping
629
M.colorschemes['schemer-dark'] = {
630
    base00 = 0, base01 = 8, base02 = 8, base03 = 8,
631
    base04 = 7, base05 = 15, base06 = 7, base07 = 15,
632
    base08 = 1, base09 = 3, base0A = 3, base0B = 2,
633
    base0C = 6, base0D = 4, base0E = 5, base0F = 8,
634
    cterm00 = 0, cterm01 = 8, cterm02 = 8, cterm03 = 8,
635
    cterm04 = 7, cterm05 = 15, cterm06 = 7, cterm07 = 15,
636
    cterm08 = 1, cterm09 = 3, cterm0A = 3, cterm0B = 2,
637
    cterm0C = 6, cterm0D = 4, cterm0E = 5, cterm0F = 8,
638
}
639
M.colorschemes['schemer-medium'] = {
640
    base00 = 0, base01 = 8, base02 = 8, base03 = 8,
641
    base04 = 7, base05 = 15, base06 = 7, base07 = 15,
642
    base08 = 1, base09 = 3, base0A = 3, base0B = 2,
643
    base0C = 6, base0D = 4, base0E = 5, base0F = 8,
644
    cterm00 = 0, cterm01 = 8, cterm02 = 8, cterm03 = 8,
645
    cterm04 = 7, cterm05 = 15, cterm06 = 7, cterm07 = 15,
646
    cterm08 = 1, cterm09 = 3, cterm0A = 3, cterm0B = 2,
647
    cterm0C = 6, cterm0D = 4, cterm0E = 5, cterm0F = 8,
648
}
649
650
M.load_from_shell = function()
651
    -- tinted-theming/base16-shell uses XDG_CONFIG_PATH if present.
652
    local config_dir = vim.env.XDG_CONFIG_HOME
653
    if config_dir == nil or config_dir == '' then
654
        config_dir = '~/.config'
655
    end
656
657
    local shell_theme_paths = {
658
        -- tinted-theming/base16-shell writes this file
659
        config_dir .. "/tinted-theming/set_theme.lua",
660
        -- chriskempson/base16-shell writes this file
661
        "~/.vimrc_background",
662
    }
663
664
    for _, path in pairs(shell_theme_paths) do
665
        local is_readable = vim.fn.filereadable(vim.fn.expand(path)) == 1
666
        if is_readable then
667
            vim.cmd([[let base16colorspace=256]])
668
            vim.cmd("source " .. path)
669
            return path
670
        end
671
    end
672
    return false
673
end
674
675
return M