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

feat: transparent background support #93

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ use {
-- Supported: terminal, qf, vista_kind, packer, nvim-tree, telescope, whichkey
alternate_backgrounds = false,

-- Or make all backgrounds transparent
transparent_backgrounds = false,

-- Callback function to define custom color groups
-- See 'lua/nordic/colors/example.lua' for example defitions
custom_colors = function(c, s, cs)
Expand Down Expand Up @@ -76,7 +79,8 @@ require('nordic').colorscheme({
italic = true,
italic_comments = false,
minimal_mode = false,
alternate_backgrounds = false
alternate_backgrounds = false,
transparent_backgrounds = false,
})
```

Expand All @@ -88,6 +92,7 @@ vim.g.nord_italic = true
vim.g.nord_italic_comments = false
vim.g.nord_minimal_mode = false
vim.g.nord_alternate_backgrounds = false
vim.g.nord_transparent_backgrounds = false
vim.cmd('colorscheme nordic')
```

Expand All @@ -99,6 +104,7 @@ let g:nord_italic = v:true
let g:nord_italic_comments = v:false
let g:nord_minimal_mode = v:false
let g:nord_alternate_backgrounds = v:false
let g:nord_transparent_backgrounds = v:false
colorscheme nordic
```

Expand Down
34 changes: 17 additions & 17 deletions lua/nordic/colors/standard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ return function(c, s, cs, opts)
{ '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 },
{ 'Normal', c.dark_white, cs.bg_normal },
{ 'NormalAlt', c.dark_white, cs.bg_normal_alt },
{ 'PMenu', c.dark_white, c.bright_black },
{ 'PmenuSbar', c.dark_white, c.bright_black },
{ 'PMenuSel', c.bright_cyan, c.gray, s.bold },
Expand Down Expand Up @@ -37,10 +37,10 @@ return function(c, s, cs, opts)
--- 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 },
{ 'Folded', c.gray, cs.bg_normal },
{ 'FoldColumn', c.gray, cs.bg_normal },
{ 'SignColumn', c.black, cs.bg_normal },
{ 'SignColumnAlt', c.black, cs.bg_normal_alt },
-- Navigation ---
{ 'Directory', c.bright_cyan },
--- Prompt/Status ---
Expand All @@ -66,26 +66,26 @@ return function(c, s, cs, opts)
--- Editor---
{ 'CursorLine', c.none, c.darkish_black },
{ 'NormalFloat', c.white, c.none },
{ 'FloatBorder', c.grayish, c.dark_black },
{ 'FloatTitle', c.grayish, c.dark_black },
{ 'FloatBorder', c.grayish, cs.bg_normal },
{ 'FloatTitle', c.grayish, cs.bg_normal },
--- 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', c.dark_white, cs.bg_normal },
{ 'StatusLineNC', c.grayish, cs.bg_normal },
{ 'StatusLineTerm', c.dark_white, cs.bg_normal },
{ 'StatusLineTermNC', c.grayish, cs.bg_normal },
--- Tabs ---
{ 'TabLine', c.grayish, c.dark_black },
{ 'TabLineFill', c.grayish, c.dark_black },
{ 'TabLineSel', c.bright_white, c.dark_black },
{ 'TabLine', c.grayish, cs.bg_normal },
{ 'TabLineFill', c.grayish, cs.bg_normal },
{ 'TabLineSel', c.bright_white, cs.bg_normal },
}
end

return {
--- Editor---
{ 'NormalFloat', c.white, c.black },
{ 'CursorLine', c.none, c.black },
{ 'FloatBorder', c.black, c.dark_black },
{ 'FloatTitle', c.grayish, c.dark_black },
{ 'FloatBorder', c.black, cs.bg_normal },
{ 'FloatTitle', c.grayish, cs.bg_normal },
--- Prompt/Status ---
{ 'StatusLine', c.bright_cyan, c.gray },
{ 'StatusLineNC', c.dark_white, c.black },
Expand Down
12 changes: 6 additions & 6 deletions lua/nordic/colors/winshift.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-- 'sindrets/winshift.nvim'
return function(c, s)
return function(c, s, cs)
return {
{ { 'WinShiftNormal', 'WinShiftEndOfBuffer' }, c.none, c.dark_black_alt },
{ 'WinShiftLineNr', c.yellow, c.dark_black_alt },
{ 'WinShiftCursorLineNr', c.yellow, c.dark_black_alt, s.bold },
{ 'WinShiftSignColumn', c.cyan, c.dark_black_alt },
{ { 'WinShiftNormal', 'WinShiftEndOfBuffer' }, c.none, cs.bg_normal_alt },
{ 'WinShiftLineNr', c.yellow, cs.bg_normal_alt },
{ 'WinShiftCursorLineNr', c.yellow, cs.bg_normal_alt, s.bold },
{ 'WinShiftSignColumn', c.cyan, cs.bg_normal_alt },
{ 'WinShiftWindowPicker', c.purple, c.blue, s.bold },
{ 'WinShiftFoldColumn', c.cyan, c.dark_black_alt },
{ 'WinShiftFoldColumn', c.cyan, cs.bg_normal_alt },
}
end
6 changes: 6 additions & 0 deletions lua/nordic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local default_opts = {
italic_comments = false,
minimal_mode = false,
alternate_backgrounds = false,
transparent_backgrounds = false,
custom_colors = function()
return {}
end,
Expand Down Expand Up @@ -85,7 +86,12 @@ local function create_arguments(options, alternatives)
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,
bg_normal = options.transparent_backgrounds == false and palette.dark_black or s.none,
bg_normal_alt = options.transparent_backgrounds == false and palette.dark_black_alt or s.none,
bg = function(name)
if options.transparent_backgrounds then
return s.none
end
local found = vim.tbl_contains(alternatives.extensions, name)
return found and palette.dark_black_alt or palette.dark_black
end,
Expand Down