feat: extras highlight token

This commit is contained in:
Max Miliano 2023-12-21 20:22:41 -03:00
parent 2f8d2d7a08
commit c389ad2506
33 changed files with 349 additions and 82 deletions

View file

@ -101,6 +101,7 @@ require('solarized').setup({
enables = {
bufferline = true,
cmp = true,
custom = true, -- solarized's custom highlights
diagnostic = true,
dashboard = true,
editor = true,
@ -124,7 +125,10 @@ require('solarized').setup({
},
highlights = {},
colors = {},
theme = 'default', -- or 'neosolarized' or 'neo' for short
theme = 'default', -- or 'neo'
extras = {
highlight_token = false,
},
})
vim.cmd.colorscheme = 'solarized'

View file

@ -121,6 +121,7 @@ DEFAULT CONFIG *solarized.nvim-default-config*
enables = {
bufferline = true,
cmp = true,
custom = true, -- solarized's custom highlights
diagnostic = true,
dashboard = true,
editor = true,
@ -144,7 +145,10 @@ DEFAULT CONFIG *solarized.nvim-default-config*
},
highlights = {},
colors = {},
theme = 'default', -- or 'neosolarized' or 'neo' for short
theme = 'default', -- or 'neo'
extras = {
highlight_token = false,
},
})
vim.cmd.colorscheme = 'solarized'

36
lua/solarized/autocmd.lua Normal file
View file

@ -0,0 +1,36 @@
vim.api.nvim_create_autocmd('LspTokenUpdate', {
callback = function(args)
local token = args.data.token
local buffer = args.buf
local text = vim.api.nvim_buf_get_text(
buffer,
token.line,
token.start_col,
token.line,
token.end_col,
{}
)[1]
local highlights = {
'TODO',
'WARN',
'TEST',
'PERF',
'NOTE',
'HACK',
'FIX',
}
local name = 'SolarizedTodo'
for _, group_name in pairs(highlights) do
if text ~= nil and token.type == 'comment' and text:match(group_name) then
vim.lsp.semantic_tokens.highlight_token(
token,
buffer,
args.data.client_id,
name .. group_name
)
end
end
end,
})

View file

@ -22,16 +22,16 @@ local subcommands = {
}
local desc = colors_desc[color]
if not desc then
return ''
end
if not desc then return '' end
return desc
end
local function set_lines(color, hex, line)
vim.api.nvim_buf_set_lines(buf, line, (line + 1), false, {
color .. string.rep('.', max_length - #color) .. ' = "' .. tostring(hex) .. '" ' .. color_desc(color),
color .. string.rep('.', max_length - #color) .. ' = "' .. tostring(
hex
) .. '" ' .. color_desc(color),
})
return line + 1
end

View file

@ -26,6 +26,7 @@ function M.default_config()
enables = {
bufferline = true,
cmp = true,
custom = true,
diagnostic = true,
dashboard = true,
editor = true,
@ -50,17 +51,16 @@ function M.default_config()
highlights = {},
colors = {},
theme = 'default',
extras = {
highlight_token = false,
},
}
end
function M.load()
if vim.g.colors_name then
vim.cmd('hi clear')
end
if vim.g.colors_name then vim.cmd('hi clear') end
if vim.fn.exists('syntax_on') then
vim.cmd('syntax reset')
end
if vim.fn.exists('syntax_on') then vim.cmd('syntax reset') end
vim.o.termguicolors = true
vim.g.colors_name = 'solarized'
@ -94,7 +94,8 @@ function M.setup(opts)
M.colors = palette.extend_colors(colors, M.config.colors)
end,
fnc = function()
M.colors = palette.extend_colors(colors, M.config.colors(colors, colorhelper))
M.colors =
palette.extend_colors(colors, M.config.colors(colors, colorhelper))
end,
}, M.config.colors)
end

View file

@ -25,7 +25,8 @@ end
function M.load_plugins(colors, config)
for plugin, enabled in pairs(config.enables) do
if enabled then
local highlight_groups = require(string.format('solarized.themes.%s.%s', config.theme, plugin))
local highlight_groups =
require(string.format('solarized.themes.%s.%s', config.theme, plugin))
highlight_groups(colors, config)
end
@ -44,6 +45,10 @@ function M.highlights(colors, config)
M.load_plugins(colors, config)
end
if vim.fn.has('nvim-0.9.4') and config.extras.highlight_token then
require('solarized.autocmd')
end
utils.on_config({
tbl = function()
M.custom_hl(config.highlights)

View file

@ -0,0 +1,11 @@
return function(c)
local set_hl = require('solarized.utils').set_hl
set_hl('SolarizedTodoTODO', { fg = c.info })
set_hl('SolarizedTodoWARN', { fg = c.warning })
set_hl('SolarizedTodoTEST', { fg = c.violet })
set_hl('SolarizedTodoPERF', { fg = c.magenta })
set_hl('SolarizedTodoNOTE', { fg = c.hint })
set_hl('SolarizedTodoHACK', { fg = c.cyan })
set_hl('SolarizedTodoFIX', { fg = c.error })
end

View file

@ -22,11 +22,31 @@ return function(c, config)
-- set_hl('DiagnosticFloatingInfo') -- Used to color "Info" diagnostic messages in diagnostics float.
-- set_hl('DiagnosticFloatingHint') -- Used to color "Hint" diagnostic messages in diagnostics float.
-- set_hl('DiagnosticFloatingOk') -- Used to color "Ok" diagnostic messages in diagnostics float.
set_hl('DiagnosticSignError', { fg = c.error, bg = c.base02 }, { transparent = config.transparent }) -- Used for "Error" signs in sign column.
set_hl('DiagnosticSignWarn', { fg = c.warning, bg = c.base02 }, { transparent = config.transparent }) -- Used for "Warn" signs in sign column.
set_hl('DiagnosticSignInfo', { fg = c.info, bg = c.base02 }, { transparent = config.transparent }) -- Used for "Info" signs in sign column.
set_hl('DiagnosticSignHint', { fg = c.hint, bg = c.base02 }, { transparent = config.transparent }) -- Used for "Hint" signs in sign column.
set_hl('DiagnosticSignOk', { fg = c.cyan, bg = c.base02 }, { transparent = config.transparent }) -- Used for "Ok" signs in sign column.
set_hl(
'DiagnosticSignError',
{ fg = c.error, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for "Error" signs in sign column.
set_hl(
'DiagnosticSignWarn',
{ fg = c.warning, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for "Warn" signs in sign column.
set_hl(
'DiagnosticSignInfo',
{ fg = c.info, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for "Info" signs in sign column.
set_hl(
'DiagnosticSignHint',
{ fg = c.hint, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for "Hint" signs in sign column.
set_hl(
'DiagnosticSignOk',
{ fg = c.cyan, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for "Ok" signs in sign column.
-- set_hl('DiagnosticDeprecated') -- Used for deprecated or obsolete code.
-- set_hl('DiagnosticUnnecessary') -- Used for unnecessary or unused code.
end

View file

@ -19,16 +19,35 @@ return function(c, config)
set_hl('TermCursor', { link = 'Cursor' }) -- Cursor in a focused terminal
set_hl('TermCursorNC', { fg = c.base03, bg = c.base0 }) -- Cursor in an unfocused terminal
set_hl('ErrorMsg', { fg = c.error, reverse = true }) -- Error messages on the command line
set_hl('WinSeparator', { fg = c.base00, bg = c.base02 }, { transparent = config.transparent }) -- Separators between window splits
set_hl('Folded', { fg = c.base0, bg = c.base02, underline = true, bold = true }) -- Line used for closed folds
set_hl(
'WinSeparator',
{ fg = c.base00, bg = c.base02 },
{ transparent = config.transparent }
) -- Separators between window splits
set_hl(
'Folded',
{ fg = c.base0, bg = c.base02, underline = true, bold = true }
) -- Line used for closed folds
set_hl('FoldColumn', { fg = c.base0, bg = c.base02, bold = true }) -- 'foldcolumn'
set_hl('SignColumn', { fg = c.base0, bg = c.base02 }, { transparent = config.transparent }) -- Column were signs are displayed
set_hl(
'SignColumn',
{ fg = c.base0, bg = c.base02 },
{ transparent = config.transparent }
) -- Column were signs are displayed
set_hl('IncSearch', { fg = c.orange, standout = true }) -- 'incsearch' highlighting, also for the text replaced
set_hl('Substitute', { link = 'IncSearch' }) -- :substitute replacement text highlight
set_hl('LineNr', { fg = c.base01, bg = c.base02 }, { transparent = config.transparent }) -- Line number for ":number" and ":#" commands
set_hl(
'LineNr',
{ fg = c.base01, bg = c.base02 },
{ transparent = config.transparent }
) -- Line number for ":number" and ":#" commands
set_hl('LineNrAbove', { link = 'LineNr' }) -- Line number, above the cursor line
set_hl('LineNrBelow', { link = 'LineNr' }) -- Line number, below the cursor
set_hl('CursorLineNr', { fg = c.base1, bg = c.base02, bold = true }, { transparent = config.transparent }) -- Like LineNr when 'cursorline' is set
set_hl(
'CursorLineNr',
{ fg = c.base1, bg = c.base02, bold = true },
{ transparent = config.transparent }
) -- Like LineNr when 'cursorline' is set
set_hl('CursorLineFold', { link = 'FoldColumn' }) -- Like FoldColumn when 'cursorline' is set
set_hl('CursorLineSign', { link = 'SignColumn' }) -- Like SignColumn when 'cursorline' is set
set_hl('MatchParen', { fg = c.red, bg = c.base01, bold = true }) -- Character under the cursor or just before it
@ -37,12 +56,20 @@ return function(c, config)
set_hl('MsgSeparator', { link = 'Normal' }) -- Separator for scrolled messages msgsep.
set_hl('MoreMsg', { fg = c.blue }) -- more-prompt
set_hl('NonText', { fg = c.base1, bold = true }) -- '@' at the end of the window
set_hl('Normal', { fg = c.base0, bg = c.base03 }, { transparent = config.transparent }) -- Normal text
set_hl(
'Normal',
{ fg = c.base0, bg = c.base03 },
{ transparent = config.transparent }
) -- Normal text
set_hl('NormalFloat', { fg = c.base0, bg = c.base02 }) -- Normal text in floating windows
set_hl('FloatBorder', { link = 'WinSeparator', bold = true }) -- Border of floating windows.
set_hl('FloatTitle', { fg = c.orange }) -- Title of float windows.
set_hl('NormalNC', { link = 'Normal' }) -- Normal text in non-current windows.
set_hl('Pmenu', { fg = c.base0, bg = c.base02 }, { transparent = config.transparent }) -- Popup menu: Normal item
set_hl(
'Pmenu',
{ fg = c.base0, bg = c.base02 },
{ transparent = config.transparent }
) -- Popup menu: Normal item
set_hl('PmenuSel', { fg = c.base2, bg = c.base01 }) -- Popup menu: Selected item
set_hl('PmenuKind', { link = 'Pmenu' }) -- Popup menu: Normal item kind
set_hl('PmenuKindSel', { link = 'PmenuSel' }) -- Popup menu: Selected item kind
@ -60,9 +87,18 @@ return function(c, config)
set_hl('SpellRare', { sp = c.cyan, undercurl = true }) -- Word that is recognized by the spellchecker as one that is hardly ever used.
set_hl('StatusLine', { fg = c.base02, bg = c.base1 }) -- Status line of current window.
set_hl('StatusLineNC', { fg = c.base02, bg = c.base00 }) -- Status lines of not-current windows.
set_hl('TabLine', { fg = c.base0, bg = c.base02, sp = c.base0, underline = true }) -- Tab pages line, not active tab page label.
set_hl('TabLineFill', { fg = c.base0, bg = c.base02, sp = c.base0, underline = true }) -- Tab pages line, where there are no labels.
set_hl('TabLineSel', { fg = c.base2, bg = c.base01, sp = c.base0, underline = true }) -- Tab pages line, active tab page label.
set_hl(
'TabLine',
{ fg = c.base0, bg = c.base02, sp = c.base0, underline = true }
) -- Tab pages line, not active tab page label.
set_hl(
'TabLineFill',
{ fg = c.base0, bg = c.base02, sp = c.base0, underline = true }
) -- Tab pages line, where there are no labels.
set_hl(
'TabLineSel',
{ fg = c.base2, bg = c.base01, sp = c.base0, underline = true }
) -- Tab pages line, active tab page label.
set_hl('Title', { fg = c.orange, bold = true }) -- Titles for output from ":set all", ":autocmd" etc.
set_hl('Visual', { bg = c.base02, standout = true }) -- Visual mode selection.
set_hl('VisualNOS', { link = 'Visual' }) -- Visual mode selection when vim is "Not Owning the Selection".

View file

@ -2,7 +2,19 @@ return function(c, config)
local utils = require('solarized.utils')
local set_hl = utils.set_hl
set_hl('GitSignsAdd', { fg = c.add, bg = c.base02 }, { transparent = config.transparent }) -- Used for the text of 'add' signs
set_hl('GitSignsChange', { fg = c.change, bg = c.base02 }, { transparent = config.transparent }) -- Used for the text of 'change' signs
set_hl('GitSignsDelete', { fg = c.delete, bg = c.base02 }, { transparent = config.transparent }) -- Used for the text of 'delete' signs
set_hl(
'GitSignsAdd',
{ fg = c.add, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for the text of 'add' signs
set_hl(
'GitSignsChange',
{ fg = c.change, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for the text of 'change' signs
set_hl(
'GitSignsDelete',
{ fg = c.delete, bg = c.base02 },
{ transparent = config.transparent }
) -- Used for the text of 'delete' signs
end

View file

@ -5,7 +5,10 @@ return function(c)
set_hl('IndentBlanklineChar', { fg = c.base01 }) -- Highlight of indent character. Default: Whitespace
set_hl('IndentBlanklineSpaceChar', { link = 'IndentBlanklineChar' }) -- Highlight of space character. Default: Whitespace
set_hl('IndentBlanklineContextChar', { fg = c.base0 }) -- Highlight of indent character when base of current context. Default: Label
set_hl('IndentBlanklineContextSpaceChar', { link = 'IndentBlanklineContextChar' }) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl(
'IndentBlanklineContextSpaceChar',
{ link = 'IndentBlanklineContextChar' }
) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl('IblIndent', { fg = c.base0, nocombine = true })
set_hl('IblScope', { fg = c.base01, nocombine = true })

View file

@ -4,7 +4,11 @@ return function(c, config)
-- Float window
set_hl('SagaNormal', { link = 'Pmenu' })
set_hl('TitleString', { fg = c.orange, bold = true, bg = c.base02 }, { transparent = config.transparent })
set_hl(
'TitleString',
{ fg = c.orange, bold = true, bg = c.base02 },
{ transparent = config.transparent }
)
-- Outline
set_hl('OutlineIndent', { fg = c.green })

View file

@ -7,12 +7,21 @@ return function(c)
set_hl('NeogitCursorLine', { link = 'CursorLine' })
set_hl('NeogitBranch', { fg = c.magenta })
set_hl('NeogitRemote', { fg = c.violet })
set_hl('NeogitHunkHeader', { fg = c.orange, bg = blend(c.orange, c.base03, alpha) })
set_hl(
'NeogitHunkHeader',
{ fg = c.orange, bg = blend(c.orange, c.base03, alpha) }
)
set_hl('NeogitHunkHeaderHighlight', { link = 'Title' })
set_hl('NeogitDiffContextHighlight', { fg = c.base00, bg = c.base03 })
set_hl('NeogitDiffContext', { fg = c.base00, bg = c.base03 })
set_hl('NeogitDiffDeleteHighlight', { fg = c.red, bg = blend(c.red, c.base03, alpha) })
set_hl(
'NeogitDiffDeleteHighlight',
{ fg = c.red, bg = blend(c.red, c.base03, alpha) }
)
set_hl('NeogitDiffDelete', { fg = c.red })
set_hl('NeogitDiffAddHighlight', { fg = c.green, bg = blend(c.green, c.base03, alpha) })
set_hl(
'NeogitDiffAddHighlight',
{ fg = c.green, bg = blend(c.green, c.base03, alpha) }
)
set_hl('NeogitDiffAdd', { fg = c.green })
end

View file

@ -12,7 +12,11 @@ return function(c, config)
set_hl('@lsp.type.macro', { link = 'Macro' }) -- Keyword
set_hl('@lsp.type.method', { link = 'Function' }) -- Function
set_hl('@lsp.type.namespace', { link = '@namespace' }) -- Namespace
set_hl('@lsp.type.parameter', { fg = c.base0, italic = true }, { styles = config.styles.parameters })
set_hl(
'@lsp.type.parameter',
{ fg = c.base0, italic = true },
{ styles = config.styles.parameters }
)
set_hl('@lsp.type.property', { link = '@field' }) -- Property
set_hl('@lsp.type.struct', { link = 'Structure' }) -- Structure
set_hl('@lsp.type.type', { link = 'Type' }) -- Type

View file

@ -2,7 +2,11 @@ return function(c, config)
local utils = require('solarized.utils')
local set_hl = utils.set_hl
set_hl('Comment', { fg = c.base01, italic = true }, { styles = config.styles.comments }) -- any comment
set_hl(
'Comment',
{ fg = c.base01, italic = true },
{ styles = config.styles.comments }
) -- any comment
set_hl('Constant', { fg = c.cyan }, { styles = config.styles.constants }) -- any constant
set_hl('String', { fg = c.cyan }) -- a string constant: "this is a string"
set_hl('Character', { link = 'String' }) -- a character constant: 'c', '\n'
@ -16,7 +20,11 @@ return function(c, config)
set_hl('Repeat', { link = 'Statement' }) -- for, do, while, etc.
set_hl('Label', { link = 'Statement' }) -- case, default, etc.
set_hl('Operator', { link = 'Statement' }) -- "sizeof", "+", "*", etc.
set_hl('Keyword', { fg = c.base1, bold = true }, { styles = config.styles.keywords }) -- any other keyword
set_hl(
'Keyword',
{ fg = c.base1, bold = true },
{ styles = config.styles.keywords }
) -- any other keyword
set_hl('Exception', { link = 'Statement' }) -- try, catch, throw
set_hl('PreProc', { fg = c.orange }) -- generic Preprocessor
set_hl('Include', { link = 'PreProc' }) -- preprocessor #include

View file

@ -8,7 +8,11 @@ return function(c, config)
set_hl('TelescopeMultiIcon', { fg = c.cyan })
-- "Normal" in the floating windows created by telescope.
set_hl('TelescopeNormal', { fg = c.base0, bg = c.base02 }, { transparent = config.transparent })
set_hl(
'TelescopeNormal',
{ fg = c.base0, bg = c.base02 },
{ transparent = config.transparent }
)
set_hl('TelescopePreviewNormal', { link = 'TelescopeNormal' })
set_hl('TelescopePromptNormal', { link = 'TelescopeNormal' })
set_hl('TelescopeResultsNormal', { link = 'TelescopeNormal' })

View file

@ -35,9 +35,15 @@ return function(c)
set_hl('TodoSignFIX', { fg = c.error })
set_hl('TodoBgTODO', { fg = c.info, bg = colorFunc(c.info, percentage) })
set_hl('TodoBgWARN', { fg = c.warning, bg = colorFunc(c.warning, percentage) })
set_hl(
'TodoBgWARN',
{ fg = c.warning, bg = colorFunc(c.warning, percentage) }
)
set_hl('TodoBgTEST', { fg = c.violet, bg = colorFunc(c.violet, percentage) })
set_hl('TodoBgPERF', { fg = c.magenta, bg = colorFunc(c.magenta, percentage) })
set_hl(
'TodoBgPERF',
{ fg = c.magenta, bg = colorFunc(c.magenta, percentage) }
)
set_hl('TodoBgNOTE', { fg = c.hint, bg = colorFunc(c.hint, percentage) })
set_hl('TodoBgHACK', { fg = c.cyan, bg = colorFunc(c.cyan, percentage) })
set_hl('TodoBgFIX', { fg = c.error, bg = colorFunc(c.error, percentage) })

View file

@ -31,13 +31,21 @@ return function(c, config)
set_hl('NvimTreeGitDeleted', { fg = c.delete })
-- set_hl('NvimTreeGitIgnored') -- (Comment)
-- set_hl('NvimTreeWindowPicker')
set_hl('NvimTreeNormal', { fg = c.base0, bg = c.base04 }, { transparent = config.transparent })
set_hl(
'NvimTreeNormal',
{ fg = c.base0, bg = c.base04 },
{ transparent = config.transparent }
)
set_hl('NvimTreeNormalFloat', { link = 'NvimTreeNormal' })
set_hl('NvimTreeEndOfBuffer', { fg = c.base04 }) -- (NonText)
-- set_hl('NvimTreeCursorLine') -- (CursorLine)
-- set_hl('NvimTreeCursorLineNr') -- (CursorLineNr)
-- set_hl('NvimTreeLineNr') -- (LineNr)
set_hl('NvimTreeWinSeparator', { fg = c.base04, bg = c.base04 }, { transparent = config.transparent }) -- (WinSeparator)
set_hl(
'NvimTreeWinSeparator',
{ fg = c.base04, bg = c.base04 },
{ transparent = config.transparent }
) -- (WinSeparator)
-- set_hl('NvimTreeCursorColumn') -- (CursorColumn)
--
-- There are also links for file highlight with git properties, linked to their

View file

@ -36,7 +36,11 @@ return function(c, config)
set_hl('@method.call', { link = 'Function' }) -- method calls
set_hl('@constructor', { link = 'Function' }) -- constructor calls and definitions
set_hl('@parameter', { fg = c.base0, italic = true }, { styles = config.styles.parameters }) -- parameters of a function
set_hl(
'@parameter',
{ fg = c.base0, italic = true },
{ styles = config.styles.parameters }
) -- parameters of a function
set_hl('@keyword', { link = 'Keyword' }) -- various keywords
set_hl('@keyword.coroutine', { link = 'Statement' }) -- keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)

View file

@ -0,0 +1,11 @@
return function(c)
local set_hl = require('solarized.utils').set_hl
set_hl('SolarizedTodoTODO', { fg = c.info })
set_hl('SolarizedTodoWARN', { fg = c.warning })
set_hl('SolarizedTodoTEST', { fg = c.violet })
set_hl('SolarizedTodoPERF', { fg = c.magenta })
set_hl('SolarizedTodoNOTE', { fg = c.hint })
set_hl('SolarizedTodoHACK', { fg = c.cyan })
set_hl('SolarizedTodoFIX', { fg = c.error })
end

View file

@ -24,16 +24,36 @@ return function(c, config)
set_hl('TermCursor', { link = 'Cursor' }) -- Cursor in a focused terminal
set_hl('TermCursorNC', { fg = c.base03, bg = c.base0 }) -- Cursor in an unfocused terminal
set_hl('ErrorMsg', { fg = c.error }) -- Error messages on the command line
set_hl('WinSeparator', { fg = c.cyan, bg = c.base04 }, { transparent = config.transparent }) -- Separators between window splits
set_hl(
'WinSeparator',
{ fg = c.cyan, bg = c.base04 },
{ transparent = config.transparent }
) -- Separators between window splits
set_hl('Folded', { fg = c.base0, bg = c.base02 }) -- Line used for closed folds
set_hl('FoldColumn', { fg = c.base0, bg = c.base04 }) -- 'foldcolumn'
set_hl('SignColumn', { fg = c.base0, bg = c.base03 }, { transparent = config.transparent }) -- Column were signs are displayed
set_hl('IncSearch', { fg = c.base3, bg = c.base04, bold = true }, { transparent = config.transparent }) -- 'incsearch' highlighting, also for the text replaced
set_hl(
'SignColumn',
{ fg = c.base0, bg = c.base03 },
{ transparent = config.transparent }
) -- Column were signs are displayed
set_hl(
'IncSearch',
{ fg = c.base3, bg = c.base04, bold = true },
{ transparent = config.transparent }
) -- 'incsearch' highlighting, also for the text replaced
set_hl('Substitute', { fg = c.orange, reverse = true }) -- :substitute replacement text highlight
set_hl('LineNr', { fg = c.base01, bg = c.base03 }, { transparent = config.transparent }) -- Line number for ":number" and ":#" commands
set_hl(
'LineNr',
{ fg = c.base01, bg = c.base03 },
{ transparent = config.transparent }
) -- Line number for ":number" and ":#" commands
set_hl('LineNrAbove', { link = 'LineNr' }) -- Line number, above the cursor line
set_hl('LineNrBelow', { link = 'LineNr' }) -- Line number, below the cursor
set_hl('CursorLineNr', { fg = c.base2, bg = c.base03 }, { transparent = config.transparent }) -- Like LineNr when 'cursorline' is set
set_hl(
'CursorLineNr',
{ fg = c.base2, bg = c.base03 },
{ transparent = config.transparent }
) -- Like LineNr when 'cursorline' is set
set_hl('CursorLineFold', { link = 'FoldColumn' }) -- Like FoldColumn when 'cursorline' is set
set_hl('CursorLineSign', { link = 'SignColumn' }) -- Like SignColumn when 'cursorline' is set
set_hl('MatchParen', { fg = c.base2 }) -- Character under the cursor or just before it
@ -42,12 +62,20 @@ return function(c, config)
set_hl('MsgSeparator', { link = 'Normal' }) -- Separator for scrolled messages msgsep.
set_hl('MoreMsg', { fg = c.cyan }) -- more-prompt
set_hl('NonText', { fg = c.base00 }) -- '@' at the end of the window
set_hl('Normal', { fg = c.base0, bg = c.base03 }, { transparent = config.transparent }) -- Normal text
set_hl(
'Normal',
{ fg = c.base0, bg = c.base03 },
{ transparent = config.transparent }
) -- Normal text
set_hl('NormalFloat', { fg = c.base0, bg = c.base04 }) -- Normal text in floating windows
set_hl('FloatBorder', { link = 'WinSeparator' }) -- Border of floating windows.
set_hl('FloatTitle', { fg = c.orange }) -- Title of float windows.
set_hl('NormalNC', { link = 'Normal' }) -- Normal text in non-current windows.
set_hl('Pmenu', { fg = c.base0, bg = c.base04 }, { transparent = config.transparent }) -- Popup menu: Normal item
set_hl(
'Pmenu',
{ fg = c.base0, bg = c.base04 },
{ transparent = config.transparent }
) -- Popup menu: Normal item
set_hl('PmenuSel', { fg = c.base2 }) -- Popup menu: Selected item
set_hl('PmenuKind', { link = 'Pmenu' }) -- Popup menu: Normal item kind
set_hl('PmenuKindSel', { link = 'PmenuSel' }) -- Popup menu: Selected item kind

View file

@ -9,14 +9,20 @@ return function(c)
set_hl('IndentBlanklineChar', { fg = darken(c.green, 20) }) -- Highlight of indent character. Default: Whitespace
set_hl('IndentBlanklineSpaceChar', { link = 'IndentBlanklineChar' }) -- Highlight of space character. Default: Whitespace
set_hl('IndentBlanklineContextChar', { fg = c.green }) -- Highlight of indent character when base of current context. Default: Label
set_hl('IndentBlanklineContextSpaceChar', { link = 'IndentBlanklineContextChar' }) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl(
'IndentBlanklineContextSpaceChar',
{ link = 'IndentBlanklineContextChar' }
) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl('IblIndent', { fg = darken(c.green, 20), nocombine = true })
set_hl('IblScope', { fg = c.green, nocombine = true })
else
set_hl('IndentBlanklineChar', { fg = lighten(c.blue, 20) }) -- Highlight of indent character. Default: Whitespace
set_hl('IndentBlanklineSpaceChar', { link = 'IndentBlanklineChar' }) -- Highlight of space character. Default: Whitespace
set_hl('IndentBlanklineContextChar', { fg = c.blue }) -- Highlight of indent character when base of current context. Default: Label
set_hl('IndentBlanklineContextSpaceChar', { link = 'IndentBlanklineContextChar' }) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl(
'IndentBlanklineContextSpaceChar',
{ link = 'IndentBlanklineContextChar' }
) -- Highlight of space characters one indent level of the current context. Default: Label
set_hl('IblIndent', { fg = lighten(c.blue, 20), nocombine = true })
set_hl('IblScope', { fg = c.blue, nocombine = true })
end

View file

@ -4,7 +4,11 @@ return function(c, config)
-- Float window
set_hl('SagaNormal', { link = 'Pmenu' })
set_hl('TitleString', { fg = c.orange, bold = true, bg = c.base02 }, { transparent = config.transparent })
set_hl(
'TitleString',
{ fg = c.orange, bold = true, bg = c.base02 },
{ transparent = config.transparent }
)
-- Outline
set_hl('OutlineIndent', { fg = c.green })

View file

@ -7,12 +7,21 @@ return function(c)
set_hl('NeogitCursorLine', { link = 'CursorLine' })
set_hl('NeogitBranch', { fg = c.magenta })
set_hl('NeogitRemote', { fg = c.violet })
set_hl('NeogitHunkHeader', { fg = c.orange, bg = blend(c.orange, c.base03, alpha) })
set_hl(
'NeogitHunkHeader',
{ fg = c.orange, bg = blend(c.orange, c.base03, alpha) }
)
set_hl('NeogitHunkHeaderHighlight', { link = 'Title' })
set_hl('NeogitDiffContextHighlight', { fg = c.base00, bg = c.base03 })
set_hl('NeogitDiffContext', { fg = c.base00, bg = c.base03 })
set_hl('NeogitDiffDeleteHighlight', { fg = c.red, bg = blend(c.red, c.base03, alpha) })
set_hl(
'NeogitDiffDeleteHighlight',
{ fg = c.red, bg = blend(c.red, c.base03, alpha) }
)
set_hl('NeogitDiffDelete', { fg = c.red })
set_hl('NeogitDiffAddHighlight', { fg = c.green, bg = blend(c.green, c.base03, alpha) })
set_hl(
'NeogitDiffAddHighlight',
{ fg = c.green, bg = blend(c.green, c.base03, alpha) }
)
set_hl('NeogitDiffAdd', { fg = c.green })
end

View file

@ -12,7 +12,11 @@ return function(c, config)
set_hl('@lsp.type.macro', { link = 'Keyword' }) -- Keyword
set_hl('@lsp.type.method', { link = 'Function' }) -- Function
set_hl('@lsp.type.namespace', { link = 'Constant' }) -- Constant
set_hl('@lsp.type.parameter', { fg = c.orange, italic = true }, { styles = config.styles.parameters })
set_hl(
'@lsp.type.parameter',
{ fg = c.orange, italic = true },
{ styles = config.styles.parameters }
)
set_hl('@lsp.type.property', { fg = c.blue }) -- Property
set_hl('@lsp.type.struct', { link = 'Structure' }) -- Structure
set_hl('@lsp.type.type', { link = 'Type' }) -- Type

View file

@ -2,7 +2,11 @@ return function(c, config)
local utils = require('solarized.utils')
local set_hl = utils.set_hl
set_hl('Comment', { fg = c.base01, italic = true }, { styles = config.styles.comments }) -- any comment
set_hl(
'Comment',
{ fg = c.base01, italic = true },
{ styles = config.styles.comments }
) -- any comment
set_hl('Constant', { fg = c.violet }, { styles = config.styles.constants }) -- any constant
set_hl('String', { fg = c.cyan }) -- a string constant: "this is a string"
set_hl('Character', { link = 'String' }) -- a character constant: 'c', '\n'

View file

@ -8,7 +8,11 @@ return function(c, config)
set_hl('TelescopeMultiIcon', { fg = c.cyan })
-- "Normal" in the floating windows created by telescope.
set_hl('TelescopeNormal', { fg = c.base0, bg = c.base04 }, { transparent = config.transparent })
set_hl(
'TelescopeNormal',
{ fg = c.base0, bg = c.base04 },
{ transparent = config.transparent }
)
set_hl('TelescopePreviewNormal', { link = 'TelescopeNormal' })
set_hl('TelescopePromptNormal', { link = 'TelescopeNormal' })
set_hl('TelescopeResultsNormal', { link = 'TelescopeNormal' })

View file

@ -35,9 +35,15 @@ return function(c)
set_hl('TodoSignFIX', { fg = c.error })
set_hl('TodoBgTODO', { fg = c.info, bg = colorFunc(c.info, percentage) })
set_hl('TodoBgWARN', { fg = c.warning, bg = colorFunc(c.warning, percentage) })
set_hl(
'TodoBgWARN',
{ fg = c.warning, bg = colorFunc(c.warning, percentage) }
)
set_hl('TodoBgTEST', { fg = c.violet, bg = colorFunc(c.violet, percentage) })
set_hl('TodoBgPERF', { fg = c.magenta, bg = colorFunc(c.magenta, percentage) })
set_hl(
'TodoBgPERF',
{ fg = c.magenta, bg = colorFunc(c.magenta, percentage) }
)
set_hl('TodoBgNOTE', { fg = c.hint, bg = colorFunc(c.hint, percentage) })
set_hl('TodoBgHACK', { fg = c.cyan, bg = colorFunc(c.cyan, percentage) })
set_hl('TodoBgFIX', { fg = c.error, bg = colorFunc(c.error, percentage) })

View file

@ -31,13 +31,21 @@ return function(c, config)
set_hl('NvimTreeGitDeleted', { fg = c.delete })
-- set_hl('NvimTreeGitIgnored') -- (Comment)
-- set_hl('NvimTreeWindowPicker')
set_hl('NvimTreeNormal', { fg = c.base0, bg = c.base04 }, { transparent = config.transparent })
set_hl(
'NvimTreeNormal',
{ fg = c.base0, bg = c.base04 },
{ transparent = config.transparent }
)
set_hl('NvimTreeNormalFloat', { link = 'NvimTreeNormal' })
set_hl('NvimTreeEndOfBuffer', { fg = c.base04 }) -- (NonText)
-- set_hl('NvimTreeCursorLine') -- (CursorLine)
-- set_hl('NvimTreeCursorLineNr') -- (CursorLineNr)
-- set_hl('NvimTreeLineNr') -- (LineNr)
set_hl('NvimTreeWinSeparator', { fg = c.base04, bg = c.base04 }, { transparent = config.transparent }) -- (WinSeparator)
set_hl(
'NvimTreeWinSeparator',
{ fg = c.base04, bg = c.base04 },
{ transparent = config.transparent }
) -- (WinSeparator)
-- set_hl('NvimTreeCursorColumn') -- (CursorColumn)
--
-- There are also links for file highlight with git properties, linked to their

View file

@ -36,7 +36,11 @@ return function(c, config)
set_hl('@method.call', { link = 'Function' }) -- method calls
set_hl('@constructor', { fg = c.magenta }) -- constructor calls and definitions
set_hl('@parameter', { fg = c.orange, italic = true }, { styles = config.styles.parameters }) -- parameters of a function
set_hl(
'@parameter',
{ fg = c.orange, italic = true },
{ styles = config.styles.parameters }
) -- parameters of a function
set_hl('@keyword', { link = 'Keyword' }) -- various keywords
set_hl('@keyword.coroutine', { link = 'Keyword' }) -- keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)

View file

@ -78,7 +78,11 @@ function M.blend(hex_fg, hex_bg, alpha)
return floor(min(max(0, ret), 255) + 0.5)
end
return M.rgb_to_hex(blend_channel(red_fg, red_bg), blend_channel(green_fg, green_bg), blend_channel(blue_fg, blue_bg))
return M.rgb_to_hex(
blend_channel(red_fg, red_bg),
blend_channel(green_fg, green_bg),
blend_channel(blue_fg, blue_bg)
)
end
return M

View file

@ -11,18 +11,12 @@ function M.set_hl(name, val, opts)
local default_val = { fg = 'NONE', bg = 'NONE' }
val = val or {}
if not val.link then
val = vim.tbl_extend('force', default_val, val)
end
if not val.link then val = vim.tbl_extend('force', default_val, val) end
if opts then
if opts.styles then
val = vim.tbl_extend('force', val, opts.styles)
end
if opts.styles then val = vim.tbl_extend('force', val, opts.styles) end
if opts.transparent then
val.bg = 'NONE'
end
if opts.transparent then val.bg = 'NONE' end
end
vim.api.nvim_set_hl(0, name, val)
@ -32,11 +26,10 @@ end
--- @param highlight_name string
--- @return table highlight
function M.get_hl(highlight_name)
local highlight = vim.api.nvim_get_hl(0, { name = highlight_name, link = true })
local highlight =
vim.api.nvim_get_hl(0, { name = highlight_name, link = true })
if highlight.link then
return M.get_hl(highlight.link)
end
if highlight.link then return M.get_hl(highlight.link) end
return highlight
end

View file

@ -1,5 +1,8 @@
vim.api.nvim_create_user_command('Solarized', function(args)
require('solarized.command').load(args.fargs[1], vim.list_slice(args.fargs, 2))
require('solarized.command').load(
args.fargs[1],
vim.list_slice(args.fargs, 2)
)
end, {
range = true,
nargs = '+',