Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: use vim.api.nvim_set_hl() #70

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lua/nordic/colors/fidget.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-- 'j-hui/fidget.nvim'
return function(c, s, cs)
return {
{ 'FidgetTitle', c.white, c.none },
{ 'FidgetTask', c.intense_blue, c.none },
FidgetTitle = { fg = c.white, bg = c.none },
FidgetTask = { fg = c.intense_blue, bg = c.none },
}
end
46 changes: 23 additions & 23 deletions lua/nordic/colors/init.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
local colors = {
'cmp',
'copilot',
'context_vt',
'diff',
'fugitive',
'gitgutter',
'gitsigns',
'hop',
'indent_blankline',
'lightspeed',
'lsp',
'lspsaga',
'markdown',
'neogit',
'neorg',
'standard',
'symbols_outline',
'syntax',
'telescope',
'vimwiki',
'whichkey',
'nvim_tree',
'packer',
-- 'cmp',
-- 'copilot',
-- 'context_vt',
-- 'diff',
-- 'fugitive',
-- 'gitgutter',
-- 'gitsigns',
-- 'hop',
-- 'indent_blankline',
-- 'lightspeed',
-- 'lsp',
-- 'lspsaga',
-- 'markdown',
-- 'neogit',
-- 'neorg',
-- 'standard',
-- 'symbols_outline',
-- 'syntax',
-- 'telescope',
-- 'vimwiki',
-- 'whichkey',
-- 'nvim_tree',
-- 'packer',
'fidget',
}

Expand Down
142 changes: 71 additions & 71 deletions lua/nordic/colors/standard.lua
Original file line number Diff line number Diff line change
@@ -1,97 +1,97 @@
return function(c, s, cs, opts)
return function(c, _, cs, opts)
return {
--- Editor---
{ 'ColorColumn', c.none, c.black },
{ 'Cursor', c.dark_black, c.dark_white },
{ 'Error', c.dark_white, c.red },
{ 'iCursor', c.dark_black, c.dark_white },
{ 'LineNr', c.gray },
{ 'MatchParen', c.bright_cyan, c.gray },
{ 'NonText', c.bright_black },
{ 'Normal', c.dark_white, c.dark_black },
{ 'NormalAlt', c.dark_white, c.dark_black_alt },
{ 'PMenu', c.dark_white, c.bright_black },
{ 'PmenuSbar', c.dark_white, c.bright_black },
{ 'PMenuSel', c.bright_cyan, c.gray, s.bold },
{ 'PmenuThumb', c.bright_cyan, c.gray },
{ 'SpecialKey', c.gray },
{ 'SpellBad', c.red, c.none, cs.underline },
{ 'SpellCap', c.yellow, c.none, cs.underline },
{ 'SpellLocal', c.white, c.none, cs.underline },
{ 'SpellRare', c.bright_white, c.none, cs.underline },
{ 'Visual', c.none, c.bright_black },
{ 'VisualNOS', c.none, c.bright_black },
{ 'VertSplit', c.black },
{ 'VisualNC', c.none, c.bright_black },
{ 'NormalNC', c.dark_white, c.none },
{ 'RedrawDebugNormal', c.dark_black, c.dark_white },
{ 'RedrawDebugClear', c.dark_white, c.yellow },
{ 'RedrawDebugComposed', c.dark_white, c.green },
{ 'RedrawDebugRecompose', c.dark_white, c.red },
ColorColumn = { fg = c.none, bg = c.black },
Cursor = { fg = c.dark_black, bg = c.dark_white },
Error = { fg = c.dark_white, bg = c.red },
iCursor = { fg = c.dark_black, bg = c.dark_white },
LineNr = { fg = c.gray },
MatchParen = { fg = c.bright_cyan, bg = c.gray },
NonText = { fg = c.bright_black },
Normal = { fg = c.dark_white, bg = c.dark_black },
NormalAlt = { fg = c.dark_white, bg = c.dark_black_alt },
PMenu = { fg = c.dark_white, bg = c.bright_black },
PmenuSbar = { fg = c.dark_white, bg = c.bright_black },
PMenuSel = { fg = c.bright_cyan, bg = c.gray, bold = true },
PmenuThumb = { fg = c.bright_cyan, bg = c.gray },
SpecialKey = { fg = c.gray },
SpellBad = { fg = c.red, bg = c.none, underline = cs.underline },
SpellCap = { fg = c.yellow, bg = c.none, underline = cs.underline },
SpellLocal = { fg = c.white, bg = c.none, underline = cs.underline },
SpellRare = { fg = c.bright_white, bg = c.none, underline = cs.underline },
Visual = { fg = c.none, bg = c.bright_black },
VisualNOS = { fg = c.none, bg = c.bright_black },
VertSplit = { fg = c.black },
VisualNC = { fg = c.none, bg = c.bright_black },
NormalNC = { fg = c.dark_white, bg = c.none },
RedrawDebugNormal = { fg = c.dark_black, bg = c.dark_white },
RedrawDebugClear = { fg = c.dark_white, bg = c.yellow },
RedrawDebugComposed = { fg = c.dark_white, bg = c.green },
RedrawDebugRecompose = { fg = c.dark_white, bg = c.red },
--- Neovim ---
{ 'healthError', c.red, c.black },
{ 'healthSuccess', c.green, c.black },
{ 'healthWarning', c.yellow, c.black },
{ 'TermCursorNC', c.none, c.black },
{ 'NvimInternalError', c.red, c.red },
healthError = { fg = c.red, bg = c.black },
healthSuccess = { fg = c.green, bg = c.black },
healthWarning = { fg = c.yellow, bg = c.black },
TermCursorNC = { fg = c.none, bg = c.black },
NvimInternalError = { fg = c.red, bg = c.red },
--- Gutter ---
{ 'CursorColumn', c.none, c.black },
{ 'CursorLineNr', c.dark_white, c.black },
{ 'Folded', c.gray, c.dark_black },
{ 'FoldColumn', c.gray, c.dark_black },
{ 'SignColumn', c.black, c.dark_black },
{ 'SignColumnAlt', c.black, c.dark_black_alt },
CursorColumn = { fg = c.none, bg = c.black },
CursorLineNr = { fg = c.dark_white, bg = c.black },
Folded = { fg = c.gray, bg = c.dark_black },
FoldColumn = { fg = c.gray, bg = c.dark_black },
SignColumn = { fg = c.black, bg = c.dark_black },
SignColumnAlt = { fg = c.black, bg = c.dark_black_alt },
-- Navigation ---
{ 'Directory', c.bright_cyan },
Directory = { fg = c.bright_cyan },
--- Prompt/Status ---
{ 'EndOfBuffer', c.black },
{ 'ErrorMsg', c.dark_white, c.red },
{ 'ModeMsg', c.dark_white },
{ 'MoreMsg', c.bright_cyan },
{ 'Question', c.dark_white },
{ 'WarningMsg', c.dark_black, c.yellow },
{ 'WildMenu', c.bright_cyan, c.black },
EndOfBuffer = { fg = c.black },
ErrorMsg = { fg = c.dark_white, bg = c.red },
ModeMsg = { fg = c.dark_white },
MoreMsg = { fg = c.bright_cyan },
Question = { fg = c.dark_white },
WarningMsg = { fg = c.dark_black, bg = c.yellow },
WildMenu = { fg = c.bright_cyan, bg = c.black },
--- Search ---
{ 'IncSearch', c.bright_white, c.intense_blue, s.underline },
{ 'Search', c.black, c.bright_cyan },
IncSearch = { fg = c.bright_white, bg = c.intense_blue, underline = true },
Search = { fg = c.black, bg = c.bright_cyan },
--- Window ---
{ 'Title', c.dark_white, c.none, s.bold },
Title = { fg = c.dark_white, bg = c.none, bold = true },
--- Others ---
{ 'qffilename', c.yellow, c.none, s.none },
{ 'Whitespace', c.bright_black }, -- listchars nbsp, space, tab, trail
qffilename = { fg = c.yellow, bg = c.none }, --, s.none },
Whitespace = { fg = c.bright_black }, -- listchars nbsp, space, tab, trail

function()
if opts.minimal_mode then
return {
--- Editor---
{ 'CursorLine', c.none, c.darkish_black },
{ 'NormalFloat', c.white, c.none },
{ 'FloatBorder', c.grayish, c.none },
CursorLine = { fg = c.none, bg = c.darkish_black },
NormalFloat = { fg = c.white, bg = c.none },
FloatBorder = { fg = c.grayish, bg = c.none },
--- Prompt/Status ---
{ 'StatusLine', c.dark_white, c.dark_black },
{ 'StatusLineNC', c.grayish, c.dark_black },
{ 'StatusLineTerm', c.dark_white, c.dark_black },
{ 'StatusLineTermNC', c.grayish, c.dark_black },
StatusLine = { fg = c.dark_white, bg = c.dark_black },
StatusLineNC = { fg = c.grayish, bg = c.dark_black },
StatusLineTerm = { fg = c.dark_white, bg = c.dark_black },
StatusLineTermNC = { fg = c.grayish, bg = c.dark_black },
--- Tabs ---
{ 'TabLine', c.grayish, c.dark_black },
{ 'TabLineFill', c.grayish, c.dark_black },
{ 'TabLineSel', c.bright_white, c.dark_black },
TabLine = { fg = c.grayish, bg = c.dark_black },
TabLineFill = { fg = c.grayish, bg = c.dark_black },
TabLineSel = { fg = c.bright_white, bg = c.dark_black },
}
end

return {
--- Editor---
{ 'NormalFloat', c.white, c.black },
{ 'CursorLine', c.none, c.black },
NormalFloat = { fg = c.white, bg = c.black },
CursorLine = { fg = c.none, bg = c.black },
--- Prompt/Status ---
{ 'StatusLine', c.bright_cyan, c.gray },
{ 'StatusLineNC', c.dark_white, c.black },
{ 'StatusLineTerm', c.bright_cyan, c.gray },
{ 'StatusLineTermNC', c.dark_white, c.black },
StatusLine = { fg = c.bright_cyan, bg = c.gray },
StatusLineNC = { fg = c.dark_white, bg = c.black },
StatusLineTerm = { fg = c.bright_cyan, bg = c.gray },
StatusLineTermNC = { fg = c.dark_white, bg = c.black },
--- Tabs ---
{ 'TabLine', c.dark_white, c.black },
{ 'TabLineFill', c.dark_white, c.black },
{ 'TabLineSel', c.bright_cyan, c.gray },
TabLine = { fg = c.dark_white, bg = c.black },
TabLineFill = { fg = c.dark_white, bg = c.black },
TabLineSel = { fg = c.bright_cyan, bg = c.gray },
}
end,
}
Expand Down
31 changes: 16 additions & 15 deletions lua/nordic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ local function create_arguments(options, alternatives)
end

local cs = {
underline = options.underline_option and s[options.underline_option] or s.none,
italic = (options.italic == true or options.italic == nil) and s.italic or s.none,
comments = options.italic_comments and s.italic or s.none,
underline = options.underline_option,
italic = (options.italic == true or options.italic == nil) or false,
comments = options.italic_comments,
bg = function(name)
local found = vim.tbl_contains(alternatives.extensions, name)
return found and palette.dark_black_alt or palette.dark_black
Expand All @@ -102,20 +102,21 @@ local function initialize(config)
end

local function load_group(list)
for _, group in ipairs(list) do
if type(group) == 'function' then
load_group(group(unpack(arguments)))
elseif type(group[1]) == 'table' then
print('loading group', vim.inspect(list))
for group, definition in ipairs(list) do
print(group, definition)
if type(definition) == 'function' then
print('got function')
load_group(definition(unpack(arguments)))
elseif type(definition) == 'table' then
print('got table')
vim.api.nvim_set_hl(0, group, definition)
load_group(vim.tbl_map(function(highlight)
return { highlight, group[2], group[3], group[4] }
end, group[1]))
return { highlight, definition[2], definition[3], definition[4] }
end, definition[1]))
else
vim.highlight.create(group[1], {
guifg = group[2] or 'NONE',
guibg = group[3] or 'NONE',
gui = group[4] or 'NONE',
guisp = group[5] or 'NONE',
})
print('got else')
vim.api.nvim_set_hl(0, group, definition)
end
end
end
Expand Down