Initial commit
This commit is contained in:
23
lua/coral/highlights/init.lua
Normal file
23
lua/coral/highlights/init.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(theme, config)
|
||||
config = config or {}
|
||||
|
||||
local highlights = {}
|
||||
for _, highlight in ipairs({ 'nvim', 'treesitter', 'lsp', 'plugins' }) do
|
||||
local mod = require('coral.highlights.' .. highlight)
|
||||
for hl, spec in pairs(mod.setup(theme, config)) do
|
||||
highlights[hl] = spec
|
||||
end
|
||||
end
|
||||
|
||||
return highlights
|
||||
end
|
||||
|
||||
function M.apply(highlights)
|
||||
for hl, spec in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, hl, spec)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
62
lua/coral/highlights/lsp.lua
Normal file
62
lua/coral/highlights/lsp.lua
Normal file
@@ -0,0 +1,62 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(theme, config)
|
||||
config = config or {}
|
||||
|
||||
local res = {
|
||||
['@lsp.type.comment'] = { link = '@comment' },
|
||||
|
||||
['@lsp.type.decorator'] = { link = '@attribute' },
|
||||
['@lsp.typemod.decorator.defaultLibrary'] = { link = '@attribute.builtin' },
|
||||
|
||||
['@lsp.type.enumMember'] = { link = '@constant' },
|
||||
['@lsp.type.enumMember.defaultLibrary'] = { link = '@constant.builtin' },
|
||||
|
||||
['@lsp.type.function'] = { link = '@function' },
|
||||
['@lsp.typemod.function.definition'] = { link = '@function.definition' },
|
||||
['@lsp.typemod.function.defaultLibrary'] = { link = '@function.builtin' },
|
||||
|
||||
['@lsp.type.keyword'] = { link = '@keyword' },
|
||||
|
||||
['@lsp.type.macro'] = { link = '@constant.macro' },
|
||||
|
||||
['@lsp.type.method'] = { link = '@function.method' },
|
||||
|
||||
-- modifier?
|
||||
|
||||
['@lsp.type.namespace'] = { link = '@module' },
|
||||
['@lsp.typemod.namespace.defaultLibrary'] = { link = '@module.builtin' },
|
||||
|
||||
['@lsp.type.number'] = { link = '@number' },
|
||||
|
||||
['@lsp.type.operator'] = { link = '@operator' },
|
||||
|
||||
['@lsp.type.parameter'] = { link = '@variable.parameter' },
|
||||
|
||||
['@lsp.type.property'] = { link = '@variable.member' },
|
||||
|
||||
['@lsp.type.regexp'] = { link = '@string.regexp' },
|
||||
|
||||
['@lsp.type.string'] = { link = '@string' },
|
||||
|
||||
['@lsp.type.typeParameter'] = { link = '@type' }, -- TODO: Determine accuracy
|
||||
|
||||
['@lsp.type.variable'] = { link = '@variable' },
|
||||
['@lsp.typemod.variable.defaultLibrary'] = { link = '@variable.builtin' }
|
||||
}
|
||||
|
||||
|
||||
-- Standard type definitions
|
||||
local standardTypes = { 'class', 'enum', 'event', 'interface', 'struct', 'type' }
|
||||
for _, ty in ipairs(standardTypes) do
|
||||
res['@lsp.type.' .. ty] = { link = '@type' }
|
||||
res['@lsp.typemod.' .. ty .. '.definition'] = { link = '@type.definition' }
|
||||
res['@lsp.typemod.' .. ty .. '.defaultLibrary'] = { link = '@type.builtin' }
|
||||
|
||||
res['@lsp.typemod.' .. ty .. '.deprecated'] = { fg = theme.syntax.deprecated }
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
return M
|
||||
114
lua/coral/highlights/nvim.lua
Normal file
114
lua/coral/highlights/nvim.lua
Normal file
@@ -0,0 +1,114 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(theme, _config)
|
||||
return {
|
||||
Normal = { bg = theme.ui.bg1, fg = theme.ui.fg2 },
|
||||
Title = { fg = theme.ui.fg4 },
|
||||
Whitespace = { fg = theme.ui.fg0 },
|
||||
|
||||
Identifier = { link = '@type' },
|
||||
Function = { link = '@function.call' },
|
||||
Type = { link = '@type' },
|
||||
Variable = { link = '@variable' },
|
||||
Statement = { link = '@keyword' },
|
||||
Special = { fg = theme.keyword_special },
|
||||
Keyword = { link = '@keyword' },
|
||||
Conditional = { link = '@keyword' },
|
||||
Repeat = { link = '@keyword' },
|
||||
Label = { link = 'Special' },
|
||||
Exception = { link = 'Special' },
|
||||
PreProc = { link = '@keyword' },
|
||||
|
||||
Constant = { link = '@constant' },
|
||||
String = { link = '@string' },
|
||||
Character = { link = '@string' },
|
||||
Number = { link = '@number' },
|
||||
Boolean = { link = '@boolean' },
|
||||
Float = { link = '@number.float' },
|
||||
|
||||
Quote = { link = '@string' },
|
||||
Operator = { link = '@punctuation' },
|
||||
Delimiter = { link = '@punctuation' },
|
||||
MatchParen = { link = '@punctuation' },
|
||||
|
||||
Todo = { link = '@comment.todo' },
|
||||
Question = { link = '@comment.note' },
|
||||
Comment = { link = '@comment' },
|
||||
SpecialComment = { link = '@comment' },
|
||||
|
||||
|
||||
NonText = { fg = theme.ui.fg3 },
|
||||
|
||||
SignColumn = { bg = theme.ui.bg0, fg = theme.ui.fg1 },
|
||||
ColorColumn = { bg = theme.ui.bg2 },
|
||||
|
||||
CursorLine = { bg = theme.ui.bg2 },
|
||||
CursorColumn = { link = 'CursorLine' },
|
||||
|
||||
LineNr = { fg = theme.ui.fg0 },
|
||||
CursorLineNr = { fg = theme.ui.fg4 },
|
||||
|
||||
Cursor = { fg = theme.ui.bg0, bg = theme.ui.fg0 },
|
||||
lCursor = { link = 'Cursor' },
|
||||
CursorIM = { link = 'Cursor' },
|
||||
|
||||
Search = { fg = theme.search.fg, bg = theme.search.item },
|
||||
CurSearch = { fg = theme.search.fg, bg = theme.search.current },
|
||||
IncSearch = { link = 'CurSearch' },
|
||||
Substitute = { link = 'Search' },
|
||||
|
||||
DiffAdd = { fg = theme.diff.add },
|
||||
DiffDelete = { fg = theme.diff.remove },
|
||||
DiffChange = { fg = theme.diff.change },
|
||||
DiffText = { fg = theme.diff.change },
|
||||
|
||||
diffAdded = { link = 'DiffAdd' },
|
||||
diffRemoved = { link = 'DiffDelete' },
|
||||
diffChanged = { link = 'DiffChange' },
|
||||
diffOldFile = { link = 'DiffDelete' },
|
||||
diffNewFile = { link = 'DiffAdd' },
|
||||
|
||||
Error = { fg = theme.diagnostic.error },
|
||||
ModeMsg = { fg = theme.diagnostic.info },
|
||||
MoreMsg = { fg = theme.diagnostic.info },
|
||||
MsgArea = { fg = theme.diagnostic.info },
|
||||
ErrorMsg = { fg = theme.diagnostic.error },
|
||||
WarningMsg = { fg = theme.diagnostic.warn },
|
||||
NvimInternalError = { fg = theme.diagnostic.error },
|
||||
healthError = { fg = theme.diagnostic.error },
|
||||
healthSuccess = { fg = theme.diagnostic.ok },
|
||||
healthWarning = { fg = theme.diagnostic.warn },
|
||||
|
||||
StatusLine = { fg = theme.ui.fg3, bg = theme.ui.bg2 },
|
||||
StatusLineNC = { fg = theme.ui.fg2, bg = theme.ui.bg1 },
|
||||
|
||||
SpellBad = { undercurl = true, sp = theme.diagnostic.error },
|
||||
SpellCap = { undercurl = true, sp = theme.diagnostic.warn },
|
||||
SpellLocal = { undercurl = true, sp = theme.diagnostic.warn },
|
||||
SpellRare = { undercurl = true, sp = theme.diagnostic.warn },
|
||||
|
||||
DiagnosticError = { fg = theme.diagnostic.error },
|
||||
DiagnosticWarn = { fg = theme.diagnostic.warn },
|
||||
DiagnosticInfo = { fg = theme.diagnostic.info },
|
||||
DiagnosticHint = { fg = theme.diagnostic.info },
|
||||
DiagnosticOk = { fg = theme.diagnostic.ok },
|
||||
|
||||
DiagnosticVirtualTextError = { link = 'DiagnosticError' },
|
||||
DiagnosticVirtualTextWarn = { link = 'DiagnosticWarn' },
|
||||
DiagnosticVirtualTextInfo = { link = 'DiagnosticInfo' },
|
||||
DiagnosticVirtualTextHint = { link = 'DiagnosticHint' },
|
||||
|
||||
DiagnosticFloatingError = { link = 'DiagnosticError' },
|
||||
DiagnosticFloatingWarn = { link = 'DiagnosticWarn' },
|
||||
DiagnosticFloatingInfo = { link = 'DiagnosticInfo' },
|
||||
DiagnositcFloatingHint = { link = 'DiagnosicHint' },
|
||||
DiagnosticFloatingOk = { link = 'DiagnosticOk' },
|
||||
|
||||
DiagnositcSignError = { fg = theme.diagnostic.error },
|
||||
DiagnosticSignWarn = { fg = theme.diagnostic.warn },
|
||||
DiagnosticSignInfo = { fg = theme.diagnostic.info },
|
||||
DiagnosticSignHint = { fg = theme.diagnostic.info },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
12
lua/coral/highlights/plugins.lua
Normal file
12
lua/coral/highlights/plugins.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(theme)
|
||||
return {
|
||||
-- GitSigns
|
||||
GitSignsAdd = { fg = theme.diff.add },
|
||||
GitSignsChange = { fg = theme.diff.change },
|
||||
GitSignsDelete = { fg = theme.diff.remove },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
92
lua/coral/highlights/treesitter.lua
Normal file
92
lua/coral/highlights/treesitter.lua
Normal file
@@ -0,0 +1,92 @@
|
||||
local M = {}
|
||||
|
||||
function M.setup(theme, config)
|
||||
config = config or {}
|
||||
|
||||
local syntax = theme.syntax
|
||||
local diff = theme.diff
|
||||
|
||||
return {
|
||||
['@variable'] = { fg = syntax.variable },
|
||||
['@variable.builtin'] = { fg = syntax.builtin },
|
||||
['@variable.parameter'] = { fg = syntax.parameter },
|
||||
['@variable.parameter.builtin'] = { link = '@variable.builtin' },
|
||||
['@variable.member'] = { fg = syntax.property },
|
||||
|
||||
['@constant'] = { fg = syntax.constant },
|
||||
['@constant.builtin'] = { fg = syntax.builtin },
|
||||
['@constant.macro'] = { fg = syntax.macro },
|
||||
|
||||
['@module'] = { fg = syntax.module },
|
||||
['@module.builtin'] = { link = '@module' },
|
||||
|
||||
['@label'] = { fg = syntax.keyword_special },
|
||||
|
||||
['@string'] = { fg = syntax.string },
|
||||
['@string.documentation'] = { fg = syntax.string_special },
|
||||
['@string.escape'] = { fg = syntax.string_special },
|
||||
['@string.regexp'] = { fg = syntax.string_special },
|
||||
['@string.special'] = { fg = syntax.string_special },
|
||||
|
||||
['@character'] = { fg = syntax.string },
|
||||
['@character.special'] = { fg = syntax.string_special },
|
||||
|
||||
['@boolean'] = { fg = syntax.primitive },
|
||||
['@number'] = { fg = syntax.primitive },
|
||||
['@number.float'] = { link = '@number' },
|
||||
|
||||
['@type'] = { fg = syntax.type },
|
||||
['@type.builtin'] = { fg = syntax.builtin_type },
|
||||
['@type.definition'] = { fg = syntax.type_definition },
|
||||
|
||||
['@property'] = { fg = syntax.property },
|
||||
|
||||
['@attribute'] = { fg = syntax.property },
|
||||
['@attribute.builtin'] = { link = '@attribute' },
|
||||
|
||||
['@function'] = { fg = syntax.function_definition },
|
||||
['@function.builtin'] = { fg = syntax.builtin },
|
||||
['@function.call'] = { fg = syntax.function_call },
|
||||
['@function.macro'] = { fg = syntax.macro },
|
||||
['@function.method'] = { link = '@function' },
|
||||
['@function.method.call'] = { link = '@function.call' },
|
||||
|
||||
['@constructor'] = { fg = syntax.function_definition },
|
||||
|
||||
['@operator'] = { fg = syntax.punctuation },
|
||||
|
||||
['@keyword'] = { fg = syntax.keyword },
|
||||
['@keyword.return'] = { fg = syntax.keyword_special },
|
||||
['@keyword.exception'] = { fg = syntax.keyword_special },
|
||||
['@keyword.debug'] = { fg = syntax.keyword_special },
|
||||
['@keyword.directive'] = { fg = syntax.keyword_special },
|
||||
['@keyword.directive.define'] = { link = '@keyword.directive' },
|
||||
|
||||
['@punctuation'] = { fg = syntax.punctuation },
|
||||
['@punctuation.delimiter'] = { link = '@punctuation' },
|
||||
['@punctuation.bracket'] = { link = '@punctuation' },
|
||||
['@punctuation.special'] = { link = '@punctuation' },
|
||||
|
||||
['@comment'] = { fg = syntax.comment },
|
||||
['@comment.documentation'] = { fg = syntax.comment },
|
||||
|
||||
['@comment.error'] = { fg = syntax.comment_error },
|
||||
['@comment.warning'] = { fg = syntax.comment_warn },
|
||||
['@comment.todo'] = { fg = syntax.comment_todo },
|
||||
['@comment.note'] = { fg = syntax.comment_note },
|
||||
|
||||
-- TODO: More complete markup support
|
||||
['@markup'] = {},
|
||||
|
||||
['@diff.plus'] = { fg = diff.add },
|
||||
['@diff.minus'] = { fg = diff.remove },
|
||||
['@diff.delta'] = { fg = diff.change },
|
||||
|
||||
['@tag'] = { fg = syntax.type },
|
||||
['@tag.builtin'] = { fg = syntax.builtin },
|
||||
['@tag.attribute'] = { fg = syntax.property },
|
||||
['@tag.delimiter'] = { fg = syntax.punctuation }
|
||||
}
|
||||
end
|
||||
|
||||
return M;
|
||||
Reference in New Issue
Block a user