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

Hide cusorline, theme maturing, fix inconsistent colors #46

Merged
merged 6 commits into from
Feb 20, 2023
Merged
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ require 'nordic' .setup {
bold = false,
-- Avialable styles: 'dark', 'light'.
theme = 'light',
-- Hide the cursorline when the window is not focused.
hide_unfocused = true,
},
noice = {
-- Available styles: `classic`, `flat`.
Expand Down
12 changes: 7 additions & 5 deletions lua/nordic/colors/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ palette.grey5 = palette.gray5
palette.bg = palette.gray0
palette.bg_dark = palette.black
palette.bg_highlight = palette.black

palette.bg_highlight = u.blend(palette.black, palette.bg, 0.5)
palette.bg_visual = palette.bg_highlight
palette.bg_sidebar = palette.bg
palette.bg_float = palette.bg
Expand All @@ -41,11 +43,11 @@ palette.border_float = palette.white1
palette.border_nb = palette.orange.base

-- Diffs.
local diff_blend = 0.35
local diff_blend = 0.2
palette.diff = {}
palette.diff.add = u.blend(palette.green.base, palette.bg, diff_blend)
palette.diff.change0 = u.blend(palette.blue2, palette.bg, diff_blend * 0.15)
palette.diff.change0 = u.blend(palette.blue1, palette.bg, 0.05)
palette.diff.change1 = u.blend(palette.blue2, palette.bg, diff_blend)
palette.diff.add = u.blend(palette.green.base, palette.bg, diff_blend)
palette.diff.delete = u.blend(palette.red.base, palette.bg, diff_blend)

-- Git.
Expand All @@ -65,8 +67,8 @@ palette.info = palette.blue2
palette.comment = palette.gray4

if o.cursorline.theme == 'light' then
palette.bg_highlight = palette.gray1
palette.bg_visual = palette.gray1
palette.bg_highlight = u.blend(palette.gray1, palette.bg, 0.5)
palette.bg_visual = palette.bg_highlight
end

return palette
21 changes: 21 additions & 0 deletions lua/nordic/commands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local o = require 'nordic.config'.options
local api = vim.api

function _Win_leave_hl()
vim.cmd([[setlocal cursorlineopt=number]])
end

function _Win_enter_hl()
vim.cmd([[setlocal cursorlineopt=both]])
end

if o.cursorline.hide_unfocused then

api.nvim_create_autocmd({'WinEnter'}, {
callback = _Win_enter_hl
})
api.nvim_create_autocmd({'WinLeave'}, {
callback = _Win_leave_hl
})

end
2 changes: 2 additions & 0 deletions lua/nordic/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ M.defaults = {
bold = false,
-- Avialable styles: 'dark', 'light'.
theme = 'light',
-- Hide the cursorline when the window is not focused.
hide_unfocused = true,
},
noice = {
-- Available styles: `classic`, `flat`.
Expand Down
12 changes: 12 additions & 0 deletions lua/nordic/groups/integrations/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ local groups = {
bg = c.bg,
fg = c.orange.bright,
},

-- Multi.
TelescopeMultiIcon = {
fg = c.yellow.bright,
bg = c.bg_dark,
bold = true
},
TelescopeMultiSelection = {
fg = c.fg,
bg = c.bg_dark
}

}

-- Apply the flat style.
Expand Down
4 changes: 2 additions & 2 deletions lua/nordic/groups/integrations/treesitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ return {
['@type.builtin'] = { link = 'Type' },
['@type.definition'] = { link = 'Type' },
['@punctuation.special'] = { link = 'Type' },
['@type.qualifier'] = { link = 'Builtin' },
['@storageclass'] = { link = 'Builtin' },
['@type.qualifier'] = { link = 'Keyword' },
['@storageclass'] = { link = 'Keyword' },
['@none'] = { link = 'None' },
-----------------------
}
1 change: 1 addition & 0 deletions lua/nordic/groups/integrations/vimtex.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local c = require 'nordic.colors'

return {
texGroup = { fg = c.fg },
texEnvArgName = { fg = c.cyan.base },
texMathEnvArgName = { link = 'texEnvArgName' },
texArg = { fg = c.cyan.base },
Expand Down
7 changes: 6 additions & 1 deletion lua/nordic/groups/native/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local groups = {
}, -- Screen-column at the cursor, when 'cursorcolumn' is set.

CursorLine = {
bg = u.blend(c.bg_highlight, c.bg, 0.5),
bg = c.bg_highlight,
bold = o.cursorline.bold,
}, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.

Expand Down Expand Up @@ -96,10 +96,15 @@ local groups = {
}, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.

CursorLineNr = {
bg = c.bg,
fg = c.gray5,
bold = true,
}, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.

CursorLineSign = {
bg = c.bg
},

MatchParen = {
fg = c.yellow.bright,
bold = true,
Expand Down
1 change: 1 addition & 0 deletions lua/nordic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function M.load(opts)
local groups = merge(g.get_groups(), config.options.override)
require('nordic.utils').highlight(groups)
g.set_term_colors()
require 'nordic.commands'
end

-- Expose the colorsceheme to vim.
Expand Down
1 change: 1 addition & 0 deletions lua/nordic/tests/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ config.nordic.reduced_blue = false
config.onedark.brighter_whites = false
config.cursorline.theme = 'light'
config.cursorline.bold = true
config.cursorline.hide_unfocused = false
config.noice.style = 'flat'
config.telescope.style = 'classic'
config.leap.dim_backdrop = true
Expand Down