summaryrefslogtreecommitdiff
path: root/lua/no-clown-fiesta/highlights.lua
diff options
context:
space:
mode:
authoraktersnurra <gustaf.rydholm@gmail.com>2022-10-29 18:19:38 +0200
committerGitHub <noreply@github.com>2022-10-29 18:19:38 +0200
commit2951af7bbd839ebef25e33f8bd01bd5c501f76c8 (patch)
treef1829cc7af1fc0c5900b23055d12bb0446962cfb /lua/no-clown-fiesta/highlights.lua
parent3234b296d7f70cc78ac37a51fc3cff28e7871812 (diff)
Update how options and colorscheme is set (#12)
* Update loading of colorscheme * Fix typo * Fix setting of style * Fix highlighting * Unpack style * Add empty table if props are nil * Fix concat of tables * Fix typo * Update settings * Add call set in settings * Add deep extend * Remove style field * Update README BREAKING CHANGE: updates how the colorscheme is set and the structure of the options table
Diffstat (limited to 'lua/no-clown-fiesta/highlights.lua')
-rw-r--r--lua/no-clown-fiesta/highlights.lua67
1 files changed, 43 insertions, 24 deletions
diff --git a/lua/no-clown-fiesta/highlights.lua b/lua/no-clown-fiesta/highlights.lua
index 5ebbc45..86446fc 100644
--- a/lua/no-clown-fiesta/highlights.lua
+++ b/lua/no-clown-fiesta/highlights.lua
@@ -1,22 +1,29 @@
local M = {}
-function M.highlight(palette, opts)
+function M.highlight(palette, options)
return {
- Normal = { fg = palette.fg, bg = opts.transparent_background },
+ Normal = {
+ fg = palette.fg,
+ bg = options.transparent and palette.none or palette.bg,
+ },
SignColumn = { bg = palette.bg },
MsgArea = { fg = palette.fg, bg = palette.bg },
ModeMsg = { fg = palette.fg, bg = palette.bg },
MsgSeparator = { fg = palette.fg, bg = palette.bg },
- SpellBad = { sp = palette.error_red, style = "undercurl" },
- SpellCap = { sp = palette.yellow, style = "undercurl" },
- SpellLocal = { sp = palette.green, style = "undercurl" },
- SpellRare = { sp = palette.purple, style = "undercurl" },
+ SpellBad = { sp = palette.error_red, undercurl = true },
+ SpellCap = { sp = palette.yellow, undercurl = true },
+ SpellLocal = { sp = palette.green, undercurl = true },
+ SpellRare = { sp = palette.purple, undercurl = true },
NormalNC = { fg = palette.fg, bg = palette.bg },
Pmenu = { fg = palette.light_gray, bg = palette.accent },
PmenuSel = { fg = palette.blue, bg = palette.alt_bg },
WildMenu = { fg = palette.blue, bg = palette.alt_bg },
- CursorLineNr = { fg = palette.light_gray, style = "bold" },
- Comment = { fg = palette.medium_gray, style = opts.comments },
+ CursorLineNr = { fg = palette.light_gray, bold = true },
+ Comment = vim.tbl_extend(
+ "force",
+ { fg = palette.medium_gray },
+ options.styles.comments
+ ),
Folded = { fg = palette.light_gray, bg = palette.alt_bg },
FoldColumn = { fg = palette.light_gray, bg = palette.alt_bg },
LineNr = { fg = palette.gray },
@@ -39,10 +46,10 @@ function M.highlight(palette, opts)
QuickFixLine = { bg = palette.accent },
PmenuSbar = { bg = palette.alt_bg },
PmenuThumb = { bg = palette.light_gray },
- MatchWord = { style = "underline" },
- MatchParen = { fg = palette.pale_purple, bg = palette.bg, style = "underline" },
- MatchWordCur = { style = "underline" },
- MatchParenCur = { style = "underline" },
+ MatchWord = { underline = true },
+ MatchParen = { fg = palette.pale_purple, bg = palette.bg, underline = true },
+ MatchWordCur = { underline = true },
+ MatchParenCur = { underline = true },
Cursor = { fg = palette.cursor_fg, bg = palette.cursor_bg },
lCursor = { fg = palette.cursor_fg, bg = palette.cursor_bg },
CursorIM = { fg = palette.cursor_fg, bg = palette.cursor_bg },
@@ -52,7 +59,7 @@ function M.highlight(palette, opts)
Directory = { fg = palette.blue },
SpecialKey = { fg = palette.blue },
Title = { fg = palette.blue },
- ErrorMsg = { fg = palette.error_red, bg = palette.bg, style = "bold" },
+ ErrorMsg = { fg = palette.error_red, bg = palette.bg, bold = true },
Search = { fg = palette.orange, bg = palette.alt_bg },
IncSearch = { fg = palette.cursor_fg, bg = palette.alt_bg },
Substitute = { fg = palette.alt_bg, bg = palette.gray_blue },
@@ -60,7 +67,11 @@ function M.highlight(palette, opts)
Question = { fg = palette.cyan },
EndOfBuffer = { fg = palette.bg },
NonText = { fg = palette.bg },
- Variable = { fg = palette.white, style = opts.variables },
+ Variable = vim.tbl_extend(
+ "force",
+ { fg = palette.white },
+ options.styles.variables
+ ),
String = { fg = palette.medium_gray_blue },
Character = { fg = palette.light_green },
Constant = { fg = palette.white },
@@ -68,13 +79,17 @@ function M.highlight(palette, opts)
Boolean = { fg = palette.red },
Float = { fg = palette.red },
Identifier = { fg = palette.white },
- Function = { fg = palette.cyan, style = opts.functions },
+ Function = vim.tbl_extend("force", { fg = palette.cyan }, options.styles.functions),
Operator = { fg = palette.white },
- Type = { fg = palette.white, style = opts.type },
+ Type = vim.tbl_extend("force", { fg = palette.white }, options.styles.type),
StorageClass = { fg = palette.gray_blue },
Structure = { fg = palette.gray_blue },
Typedef = { fg = palette.white },
- Keyword = { fg = palette.gray_blue, style = opts.keywords },
+ Keyword = vim.tbl_extend(
+ "force",
+ { fg = palette.gray_blue },
+ options.styles.keywords
+ ),
Statement = { fg = palette.gray_blue },
Conditional = { fg = palette.gray_blue },
Repeat = { fg = palette.gray_blue },
@@ -90,13 +105,17 @@ function M.highlight(palette, opts)
Tag = { fg = palette.pale_purple },
Debug = { fg = palette.red },
Delimiter = { fg = palette.white },
- SpecialComment = { fg = palette.medium_gray, style = opts.comments },
- Underlined = { style = "underline" },
- Bold = { style = "bold" },
- Italic = { style = "italic" },
- Ignore = { fg = palette.cyan, bg = palette.bg, style = "bold" },
- Todo = { fg = palette.red, bg = palette.bg, style = "bold" },
- Error = { fg = palette.error_red, bg = palette.bg, style = "bold" },
+ SpecialComment = vim.tbl_extend(
+ "force",
+ { fg = palette.medium_gray },
+ options.styles.comments
+ ),
+ Underlined = { underline = true },
+ Bold = { bold = true },
+ Italic = { italic = true },
+ Ignore = { fg = palette.cyan, bg = palette.bg, bold = true },
+ Todo = { fg = palette.red, bg = palette.bg, bold = true },
+ Error = { fg = palette.error_red, bg = palette.bg, bold = true },
TabLine = { fg = palette.gray, bg = palette.alt_bg },
TabLineSel = { fg = palette.white, bg = palette.alt_bg },
TabLineFill = { fg = palette.white, bg = palette.alt_bg },