|
| 1 | +local M = {} |
| 2 | + |
| 3 | +function M.highlights(palette) |
| 4 | + local highlights = { |
| 5 | + Normal = { fg = palette.fg, bg = palette.bg }, |
| 6 | + NormalNC = { fg = palette.fg, bg = palette.bg }, |
| 7 | + NormalFloat = { fg = palette.fg, bg = palette.surface_alt }, |
| 8 | + FloatBorder = { fg = palette.border, bg = palette.surface_alt }, |
| 9 | + FloatTitle = { fg = palette.accent, bg = palette.surface_alt, bold = true }, |
| 10 | + ColorColumn = { bg = palette.surface }, |
| 11 | + Conceal = { fg = palette.comment }, |
| 12 | + Cursor = { fg = palette.bg, bg = palette.cursor }, |
| 13 | + lCursor = { fg = palette.bg, bg = palette.cursor }, |
| 14 | + CursorLine = { bg = palette.line }, |
| 15 | + CursorColumn = { bg = palette.surface }, |
| 16 | + CursorLineNr = { fg = palette.type_ref, bold = true }, |
| 17 | + LineNr = { fg = palette.punct }, |
| 18 | + SignColumn = { fg = palette.punct, bg = palette.bg }, |
| 19 | + FoldColumn = { fg = palette.comment, bg = palette.bg }, |
| 20 | + Folded = { fg = palette.comment, bg = palette.surface }, |
| 21 | + Visual = { bg = palette.selection }, |
| 22 | + VisualNOS = { bg = palette.selection }, |
| 23 | + Search = { fg = palette.search_fg, bg = palette.search_bg }, |
| 24 | + CurSearch = { fg = palette.cur_search_fg, bg = palette.cur_search_bg, bold = true }, |
| 25 | + Substitute = { fg = palette.cur_search_fg, bg = palette.cur_search_bg, bold = true }, |
| 26 | + MatchParen = { fg = palette.accent, bg = palette.selection, bold = true }, |
| 27 | + Directory = { fg = palette.accent }, |
| 28 | + Title = { fg = palette.fg, bold = true }, |
| 29 | + ErrorMsg = { fg = palette.error, bg = palette.bg, bold = true }, |
| 30 | + WarningMsg = { fg = palette.warning, bg = palette.bg, bold = true }, |
| 31 | + MoreMsg = { fg = palette.accent }, |
| 32 | + ModeMsg = { fg = palette.accent }, |
| 33 | + Question = { fg = palette.accent }, |
| 34 | + NonText = { fg = palette.border }, |
| 35 | + Whitespace = { fg = palette.border }, |
| 36 | + SpecialKey = { fg = palette.comment }, |
| 37 | + EndOfBuffer = { fg = palette.bg }, |
| 38 | + WinSeparator = { fg = palette.border, bg = palette.bg }, |
| 39 | + StatusLine = { fg = palette.fg, bg = palette.surface_alt }, |
| 40 | + StatusLineNC = { fg = palette.comment, bg = palette.bg }, |
| 41 | + TabLine = { fg = palette.comment, bg = palette.surface }, |
| 42 | + TabLineFill = { fg = palette.comment, bg = palette.bg }, |
| 43 | + TabLineSel = { fg = palette.fg, bg = palette.surface_alt }, |
| 44 | + Pmenu = { fg = palette.fg, bg = palette.surface_alt }, |
| 45 | + PmenuSel = { fg = palette.fg, bg = palette.surface }, |
| 46 | + PmenuSbar = { bg = palette.surface }, |
| 47 | + PmenuThumb = { bg = palette.border }, |
| 48 | + WildMenu = { fg = palette.bg, bg = palette.accent }, |
| 49 | + QuickFixLine = { bg = palette.surface }, |
| 50 | + Comment = { fg = palette.comment }, |
| 51 | + Todo = { fg = palette.bg, bg = palette.accent, bold = true }, |
| 52 | + Keyword = { fg = palette.keyword }, |
| 53 | + Operator = { fg = palette.punct }, |
| 54 | + Delimiter = { fg = palette.punct }, |
| 55 | + Special = { fg = palette.accent }, |
| 56 | + Identifier = { fg = palette.fg }, |
| 57 | + Function = { fg = palette.fg }, |
| 58 | + String = { fg = palette.accent }, |
| 59 | + Number = { fg = palette.accent }, |
| 60 | + Boolean = { fg = palette.accent }, |
| 61 | + Constant = { fg = palette.fg }, |
| 62 | + Type = { fg = palette.type_ref }, |
| 63 | + Typedef = { fg = palette.fg }, |
| 64 | + Label = { fg = palette.fg }, |
| 65 | + Tag = { fg = palette.fg }, |
| 66 | + Underlined = { fg = palette.accent, underline = true }, |
| 67 | + Error = { fg = palette.error }, |
| 68 | + DiffAdd = { bg = palette.diff_add_bg }, |
| 69 | + DiffChange = { bg = palette.diff_change_bg }, |
| 70 | + DiffDelete = { bg = palette.diff_delete_bg }, |
| 71 | + DiffText = { fg = palette.accent, bg = palette.diff_change_bg, bold = true }, |
| 72 | + GitSignsAdd = { fg = palette.git_add, bg = palette.bg }, |
| 73 | + GitSignsChange = { fg = palette.git_change, bg = palette.bg }, |
| 74 | + GitSignsDelete = { fg = palette.git_delete, bg = palette.bg }, |
| 75 | + DiagnosticError = { fg = palette.error }, |
| 76 | + DiagnosticWarn = { fg = palette.warning }, |
| 77 | + DiagnosticInfo = { fg = palette.info }, |
| 78 | + DiagnosticHint = { fg = palette.comment }, |
| 79 | + DiagnosticOk = { fg = palette.success }, |
| 80 | + DiagnosticVirtualTextError = { fg = palette.error, bg = palette.diff_delete_bg }, |
| 81 | + DiagnosticVirtualTextWarn = { fg = palette.warning, bg = palette.diff_change_bg }, |
| 82 | + DiagnosticVirtualTextInfo = { fg = palette.info, bg = palette.surface }, |
| 83 | + DiagnosticVirtualTextHint = { fg = palette.comment, bg = palette.surface }, |
| 84 | + DiagnosticUnderlineError = { undercurl = true, sp = palette.error }, |
| 85 | + DiagnosticUnderlineWarn = { undercurl = true, sp = palette.warning }, |
| 86 | + DiagnosticUnderlineInfo = { undercurl = true, sp = palette.info }, |
| 87 | + DiagnosticUnderlineHint = { undercurl = true, sp = palette.comment }, |
| 88 | + TelescopeNormal = { fg = palette.fg, bg = palette.surface_alt }, |
| 89 | + TelescopeBorder = { fg = palette.border, bg = palette.surface_alt }, |
| 90 | + TelescopePromptNormal = { fg = palette.fg, bg = palette.surface_alt }, |
| 91 | + TelescopePromptBorder = { fg = palette.border, bg = palette.surface_alt }, |
| 92 | + TelescopePromptTitle = { fg = palette.bg, bg = palette.accent_strong, bold = true }, |
| 93 | + TelescopePreviewTitle = { fg = palette.bg, bg = palette.comment, bold = true }, |
| 94 | + TelescopeResultsTitle = { fg = palette.bg, bg = palette.type_ref, bold = true }, |
| 95 | + TelescopeSelection = { bg = palette.surface }, |
| 96 | + TelescopeMatching = { fg = palette.accent, bold = true }, |
| 97 | + } |
| 98 | + |
| 99 | + local links = { |
| 100 | + IncSearch = "CurSearch", |
| 101 | + SpecialComment = "Comment", |
| 102 | + Character = "String", |
| 103 | + Float = "Number", |
| 104 | + Conditional = "Keyword", |
| 105 | + Repeat = "Keyword", |
| 106 | + Statement = "Keyword", |
| 107 | + PreProc = "Keyword", |
| 108 | + Include = "Keyword", |
| 109 | + Define = "Keyword", |
| 110 | + Macro = "Keyword", |
| 111 | + StorageClass = "Keyword", |
| 112 | + Structure = "Keyword", |
| 113 | + Exception = "Keyword", |
| 114 | + VertSplit = "WinSeparator", |
| 115 | + ["@annotation"] = "Comment", |
| 116 | + ["@comment"] = "Comment", |
| 117 | + ["@comment.documentation"] = "Comment", |
| 118 | + ["@comment.error"] = "DiagnosticError", |
| 119 | + ["@comment.warning"] = "DiagnosticWarn", |
| 120 | + ["@comment.todo"] = "Todo", |
| 121 | + ["@comment.note"] = "DiagnosticInfo", |
| 122 | + ["@keyword"] = "Keyword", |
| 123 | + ["@keyword.conditional"] = "Keyword", |
| 124 | + ["@keyword.repeat"] = "Keyword", |
| 125 | + ["@keyword.return"] = "Keyword", |
| 126 | + ["@keyword.operator"] = "Keyword", |
| 127 | + ["@keyword.exception"] = "Keyword", |
| 128 | + ["@keyword.import"] = "Keyword", |
| 129 | + ["@keyword.directive"] = "Keyword", |
| 130 | + ["@keyword.function"] = "Keyword", |
| 131 | + ["@operator"] = "Operator", |
| 132 | + ["@punctuation"] = "Delimiter", |
| 133 | + ["@punctuation.bracket"] = "Delimiter", |
| 134 | + ["@punctuation.delimiter"] = "Delimiter", |
| 135 | + ["@string"] = "String", |
| 136 | + ["@string.documentation"] = "String", |
| 137 | + ["@string.escape"] = "String", |
| 138 | + ["@string.regex"] = "String", |
| 139 | + ["@string.special"] = "String", |
| 140 | + ["@character"] = "String", |
| 141 | + ["@character.special"] = "String", |
| 142 | + ["@number"] = "Number", |
| 143 | + ["@number.float"] = "Float", |
| 144 | + ["@boolean"] = "Boolean", |
| 145 | + ["@constant"] = "Constant", |
| 146 | + ["@constant.builtin"] = "Type", |
| 147 | + ["@constant.macro"] = "Constant", |
| 148 | + ["@module"] = "Identifier", |
| 149 | + ["@namespace"] = "Identifier", |
| 150 | + ["@symbol"] = "Constant", |
| 151 | + ["@variable"] = "Identifier", |
| 152 | + ["@variable.builtin"] = "Identifier", |
| 153 | + ["@variable.parameter"] = "Identifier", |
| 154 | + ["@variable.parameter.builtin"] = "Identifier", |
| 155 | + ["@variable.member"] = "Identifier", |
| 156 | + ["@property"] = "Identifier", |
| 157 | + ["@field"] = "Identifier", |
| 158 | + ["@constructor"] = "Identifier", |
| 159 | + ["@function"] = "Function", |
| 160 | + ["@function.builtin"] = "Function", |
| 161 | + ["@function.call"] = "Function", |
| 162 | + ["@function.macro"] = "Function", |
| 163 | + ["@method"] = "Function", |
| 164 | + ["@method.call"] = "Function", |
| 165 | + ["@function.method"] = "Function", |
| 166 | + ["@type"] = "Type", |
| 167 | + ["@type.builtin"] = "Type", |
| 168 | + ["@type.definition"] = "Identifier", |
| 169 | + ["@attribute"] = "Identifier", |
| 170 | + ["@tag"] = "Tag", |
| 171 | + ["@tag.attribute"] = "Identifier", |
| 172 | + ["@tag.delimiter"] = "Delimiter", |
| 173 | + ["@markup.heading"] = "Title", |
| 174 | + ["@markup.heading.1"] = "Title", |
| 175 | + ["@markup.heading.2"] = "Title", |
| 176 | + ["@markup.heading.3"] = "Title", |
| 177 | + ["@markup.heading.4"] = "Title", |
| 178 | + ["@markup.heading.5"] = "Title", |
| 179 | + ["@markup.heading.6"] = "Title", |
| 180 | + ["@markup.list"] = "Keyword", |
| 181 | + ["@markup.link"] = "Identifier", |
| 182 | + ["@markup.link.label"] = "Identifier", |
| 183 | + ["@markup.link.url"] = "Underlined", |
| 184 | + ["@markup.raw"] = "String", |
| 185 | + ["@markup.quote"] = "Comment", |
| 186 | + ["@markup.math"] = "String", |
| 187 | + ["@markup.strikethrough"] = "Comment", |
| 188 | + ["@diff.plus"] = "DiffAdd", |
| 189 | + ["@diff.minus"] = "DiffDelete", |
| 190 | + ["@diff.delta"] = "DiffChange", |
| 191 | + ["@lsp.type.class"] = "Type", |
| 192 | + ["@lsp.type.interface"] = "Type", |
| 193 | + ["@lsp.type.type"] = "Type", |
| 194 | + ["@lsp.type.struct"] = "Type", |
| 195 | + ["@lsp.type.enum"] = "Type", |
| 196 | + ["@lsp.type.typeParameter"] = "Identifier", |
| 197 | + ["@lsp.type.parameter"] = "Identifier", |
| 198 | + ["@lsp.type.property"] = "Identifier", |
| 199 | + ["@lsp.type.variable"] = "Identifier", |
| 200 | + ["@lsp.type.namespace"] = "Identifier", |
| 201 | + ["@lsp.type.function"] = "Function", |
| 202 | + ["@lsp.type.method"] = "Function", |
| 203 | + ["@lsp.type.enumMember"] = "Constant", |
| 204 | + ["@lsp.type.keyword"] = "Keyword", |
| 205 | + ["@lsp.typemod.class.declaration"] = "Identifier", |
| 206 | + ["@lsp.typemod.interface.declaration"] = "Identifier", |
| 207 | + ["@lsp.typemod.type.declaration"] = "Identifier", |
| 208 | + ["@lsp.typemod.enum.declaration"] = "Identifier", |
| 209 | + ["@lsp.typemod.type.defaultLibrary"] = "Type", |
| 210 | + ["@lsp.typemod.variable.defaultLibrary"] = "Type", |
| 211 | + ["@lsp.typemod.variable.readonly"] = "Constant", |
| 212 | + ["@lsp.typemod.property.readonly"] = "Constant", |
| 213 | + htmlTag = "Tag", |
| 214 | + htmlEndTag = "Tag", |
| 215 | + htmlTagName = "Tag", |
| 216 | + htmlArg = "Identifier", |
| 217 | + htmlString = "String", |
| 218 | + } |
| 219 | + |
| 220 | + for group, link in pairs(links) do |
| 221 | + highlights[group] = { link = link } |
| 222 | + end |
| 223 | + |
| 224 | + highlights["@markup.italic"] = { fg = palette.fg, italic = true } |
| 225 | + highlights["@markup.emphasis"] = { fg = palette.fg, italic = true } |
| 226 | + highlights["@markup.strong"] = { fg = palette.fg, bold = true } |
| 227 | + highlights["markdownItalic"] = { fg = palette.fg, italic = true } |
| 228 | + highlights["markdownBold"] = { fg = palette.fg, bold = true } |
| 229 | + |
| 230 | + return highlights |
| 231 | +end |
| 232 | + |
| 233 | +return M |
0 commit comments