@@ -118,23 +118,12 @@ M.ristretto = {
118
118
diff_text = ' #23324d' ,
119
119
}
120
120
121
- local function remove_italics (config , colors )
122
- if not config .italics and colors .style == ' italic' then
123
- colors .style = nil
124
- end
125
- return colors
126
- end
127
-
128
121
local function highlighter (config )
129
- return function (group , color )
130
- color = remove_italics (config , color )
131
- local style = color .style and ' gui=' .. color .style or ' gui=NONE'
132
- local fg = color .fg and ' guifg = ' .. color .fg or ' guifg = NONE'
133
- local bg = color .bg and ' guibg = ' .. color .bg or ' guibg = NONE'
134
- local sp = color .sp and ' guisp = ' .. color .sp or ' '
135
- vim .cmd (
136
- ' highlight ' .. group .. ' ' .. style .. ' ' .. fg .. ' ' .. bg .. ' ' .. sp
137
- )
122
+ return function (group , val )
123
+ if not config .italics then
124
+ val .italic = false
125
+ end
126
+ vim .api .nvim_set_hl (0 , group , val )
138
127
end
139
128
end
140
129
@@ -167,7 +156,7 @@ M.load_syntax = function(palette)
167
156
bg = palette .base3 ,
168
157
},
169
158
Cursor = {
170
- style = ' reverse' ,
159
+ reverse = true ,
171
160
},
172
161
ColorColumn = {
173
162
bg = palette .base3 ,
@@ -204,19 +193,19 @@ M.load_syntax = function(palette)
204
193
},
205
194
ModeMsg = {
206
195
fg = palette .white ,
207
- style = ' bold ' ,
196
+ bold = true ,
208
197
},
209
198
MoreMsg = {
210
199
fg = palette .white ,
211
- style = ' bold ' ,
200
+ bold = true ,
212
201
},
213
202
ErrorMsg = {
214
203
fg = palette .red ,
215
- style = ' bold ' ,
204
+ bold = true ,
216
205
},
217
206
WarningMsg = {
218
207
fg = palette .yellow ,
219
- style = ' bold ' ,
208
+ bold = true ,
220
209
},
221
210
VertSplit = {
222
211
fg = palette .brown ,
@@ -244,26 +233,26 @@ M.load_syntax = function(palette)
244
233
},
245
234
SpellBad = {
246
235
fg = palette .red ,
247
- style = ' undercurl ' ,
236
+ undercurl = true ,
248
237
},
249
238
SpellCap = {
250
239
fg = palette .purple ,
251
- style = ' undercurl ' ,
240
+ undercurl = true ,
252
241
},
253
242
SpellRare = {
254
243
fg = palette .aqua ,
255
- style = ' undercurl ' ,
244
+ undercurl = true ,
256
245
},
257
246
SpellLocal = {
258
247
fg = palette .pink ,
259
- style = ' undercurl ' ,
248
+ undercurl = true ,
260
249
},
261
250
SpecialKey = {
262
251
fg = palette .pink ,
263
252
},
264
253
Title = {
265
254
fg = palette .yellow ,
266
- style = ' bold ' ,
255
+ bold = true ,
267
256
},
268
257
Directory = {
269
258
fg = palette .aqua ,
@@ -329,7 +318,7 @@ M.load_syntax = function(palette)
329
318
},
330
319
Function = {
331
320
fg = palette .green ,
332
- style = ' italic ' ,
321
+ italic = true ,
333
322
},
334
323
Statement = {
335
324
fg = palette .pink ,
@@ -342,7 +331,7 @@ M.load_syntax = function(palette)
342
331
},
343
332
Keyword = {
344
333
fg = palette .pink ,
345
- style = ' italic ' ,
334
+ italic = true ,
346
335
},
347
336
PreProc = {
348
337
fg = palette .green ,
@@ -370,7 +359,7 @@ M.load_syntax = function(palette)
370
359
},
371
360
SpecialComment = {
372
361
fg = palette .grey ,
373
- style = ' italic ' ,
362
+ italic = true ,
374
363
},
375
364
Tag = {
376
365
fg = palette .orange ,
@@ -380,10 +369,10 @@ M.load_syntax = function(palette)
380
369
},
381
370
Comment = {
382
371
fg = palette .base6 ,
383
- style = ' italic ' ,
372
+ italic = true ,
384
373
},
385
374
Underlined = {
386
- style = ' underline ' ,
375
+ underline = true ,
387
376
},
388
377
Ignore = {},
389
378
Error = {
@@ -400,16 +389,16 @@ M.load_syntax = function(palette)
400
389
fg = palette .grey ,
401
390
},
402
391
vCursor = {
403
- style = ' reverse ' ,
392
+ reverse = true ,
404
393
},
405
394
iCursor = {
406
- style = ' reverse ' ,
395
+ reverse = true ,
407
396
},
408
397
lCursor = {
409
- style = ' reverse ' ,
398
+ reverse = true ,
410
399
},
411
400
CursorIM = {
412
- style = ' reverse ' ,
401
+ reverse = true ,
413
402
},
414
403
CursorColumn = {
415
404
bg = palette .base3 ,
@@ -423,7 +412,7 @@ M.load_syntax = function(palette)
423
412
},
424
413
QuickFixLine = {
425
414
fg = palette .purple ,
426
- style = ' bold ' ,
415
+ bold = true ,
427
416
},
428
417
Debug = {
429
418
fg = palette .orange ,
@@ -463,7 +452,7 @@ M.load_plugin_syntax = function(palette)
463
452
},
464
453
TSComment = {
465
454
fg = palette .base6 ,
466
- style = ' italic ' ,
455
+ italic = true ,
467
456
},
468
457
TSConstant = {
469
458
fg = palette .aqua ,
@@ -485,22 +474,22 @@ M.load_plugin_syntax = function(palette)
485
474
},
486
475
TSFunction = {
487
476
fg = palette .green ,
488
- style = ' italic ' ,
477
+ italic = true ,
489
478
},
490
479
TSFuncBuiltin = {
491
480
fg = palette .aqua ,
492
481
},
493
482
TSFuncMacro = {
494
483
fg = palette .green ,
495
- style = ' italic ' ,
484
+ italic = true ,
496
485
},
497
486
TSKeyword = {
498
487
fg = palette .pink ,
499
- style = ' italic ' ,
488
+ italic = true ,
500
489
},
501
490
TSKeywordFunction = {
502
491
fg = palette .pink ,
503
- style = ' italic ' ,
492
+ italic = true ,
504
493
},
505
494
TSKeywordOperator = {
506
495
fg = palette .pink ,
@@ -599,19 +588,19 @@ M.load_plugin_syntax = function(palette)
599
588
fg = palette .aqua ,
600
589
},
601
590
DiagnosticUnderlineError = {
602
- style = ' undercurl' ,
591
+ undercurl = true ,
603
592
sp = palette .red ,
604
593
},
605
594
DiagnosticUnderlineWarn = {
606
- style = ' undercurl' ,
595
+ undercurl = true ,
607
596
sp = palette .yellow ,
608
597
},
609
598
DiagnosticUnderlineInfo = {
610
- style = ' undercurl' ,
599
+ undercurl = true ,
611
600
sp = palette .white ,
612
601
},
613
602
DiagnosticUnderlineHint = {
614
- style = ' undercurl' ,
603
+ undercurl = true ,
615
604
sp = palette .aqua ,
616
605
},
617
606
CursorWord0 = {
@@ -630,7 +619,6 @@ M.load_plugin_syntax = function(palette)
630
619
},
631
620
NvimTreeSpecialFile = {
632
621
fg = palette .white ,
633
- style = ' NONE' ,
634
622
},
635
623
636
624
-- Telescope
@@ -643,7 +631,7 @@ M.load_plugin_syntax = function(palette)
643
631
},
644
632
TelescopeSelection = {
645
633
fg = palette .white ,
646
- style = ' bold' ,
634
+ bold = true ,
647
635
},
648
636
TelescopeSelectionCaret = {
649
637
fg = palette .green ,
@@ -716,6 +704,9 @@ M.setup = function(config)
716
704
local syntax = M .load_syntax (used_palette )
717
705
syntax = vim .tbl_deep_extend (' keep' , config .custom_hlgroups , syntax )
718
706
local highlight = highlighter (config )
707
+ -- https://github.com/neovim/neovim/issues/20008#issue-1355604714
708
+ -- normal must be defined first so that bg/fg can work
709
+ highlight (' Normal' , syntax [' Normal' ])
719
710
for group , colors in pairs (syntax ) do
720
711
highlight (group , colors )
721
712
end
0 commit comments