Skip to content

Commit

Permalink
Rename 'name' item on the scheme config to 'colorscheme'
Browse files Browse the repository at this point in the history
  • Loading branch information
cormacrelf committed Sep 17, 2020
1 parent 5087492 commit 70ba20b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ local dn = require('dark_notify')

-- Configure
dn.run({
schemes {
schemes = {
-- you can use a different colorscheme for each
dark = "dark colorscheme name",
-- even a different `set background=light/dark` setting or lightline theme
-- if you use lightline, you may want to configure lightline themes,
-- even if they're the same one, especially if the theme reacts to :set bg
light = {
name = "light scheme name",
background = "either light or dark",
colorscheme = "light scheme name",
background = "override to either light or dark",
lightline = "set your lightline theme name here"
}
},
Expand Down
12 changes: 6 additions & 6 deletions lua/dark_notify.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ end
function apply_mode(mode)
local config = get_config()
local sel = config.schemes[mode] or {}
local name = sel.name or nil
local colorscheme = sel.colorscheme or nil
local bg = sel.background or mode
local lltheme = sel.lightline or nil

vim.api.nvim_command('set background=' .. bg)
if name ~= nil then
vim.api.nvim_command('colorscheme ' .. name)
if colorscheme ~= nil then
vim.api.nvim_command('colorscheme ' .. colorscheme)
end

-- now try to reload lightline
Expand Down Expand Up @@ -147,7 +147,7 @@ function run(config)

for _, mode in pairs({ "light", "dark" }) do
if type(schemes[mode]) == "string" then
schemes[mode] = { name = schemes[mode] }
schemes[mode] = { colorscheme = schemes[mode] }
end
end

Expand Down Expand Up @@ -180,8 +180,8 @@ return {
-- lightline_loaders = {
-- my_colorscheme = "path_to_my_colorscheme's lightline autoload file"
-- },
-- schemes {
-- schemes = {
-- dark = "dark colorscheme name",
-- light = { name = "light scheme name", background = "optional override, either light or dark" }
-- light = { colorscheme = "light scheme name", background = "optional override, either light or dark" }
-- }
-- })

0 comments on commit 70ba20b

Please sign in to comment.