nvim: support different dark and light colorschemes
This commit is contained in:
parent
1513d23ec4
commit
29608ff8c4
@ -1,31 +1,71 @@
|
|||||||
# Colors (Gruvbox dark)
|
# Nightfox Alacritty Colors
|
||||||
|
## name: nightfox
|
||||||
|
## upstream: https://github.com/edeneast/nightfox.nvim/raw/main/extra/nightfox/alacritty.toml
|
||||||
|
|
||||||
# Default colors
|
|
||||||
[colors.primary]
|
[colors.primary]
|
||||||
# hard contrast background = = '#1d2021'
|
background = "#2e3440" # changed
|
||||||
# background = '#282828'
|
foreground = "#eceff4" # changed
|
||||||
# soft contrast background = = '#32302f'
|
dim_foreground = "#aeafb0"
|
||||||
background = '#292522'
|
bright_foreground = "#d6d6d7"
|
||||||
foreground = '#ebdbb2'
|
|
||||||
|
[colors.cursor]
|
||||||
|
text = "#cdcecf"
|
||||||
|
cursor = "#aeafb0"
|
||||||
|
|
||||||
|
[colors.vi_mode_cursor]
|
||||||
|
text = "#cdcecf"
|
||||||
|
cursor = "#63cdcf"
|
||||||
|
|
||||||
|
[colors.search.matches]
|
||||||
|
foreground = "#cdcecf"
|
||||||
|
background = "#3c5372"
|
||||||
|
|
||||||
|
[colors.search.focused_match]
|
||||||
|
foreground = "#cdcecf"
|
||||||
|
background = "#81b29a"
|
||||||
|
|
||||||
|
[colors.footer_bar]
|
||||||
|
foreground = "#cdcecf"
|
||||||
|
background = "#29394f"
|
||||||
|
|
||||||
|
[colors.hints.start]
|
||||||
|
foreground = "#cdcecf"
|
||||||
|
background = "#f4a261"
|
||||||
|
|
||||||
|
[colors.hints.end]
|
||||||
|
foreground = "#cdcecf"
|
||||||
|
background = "#29394f"
|
||||||
|
|
||||||
|
[colors.selection]
|
||||||
|
text = "#cdcecf"
|
||||||
|
background = "#2b3b51"
|
||||||
|
|
||||||
# Normal colors
|
|
||||||
[colors.normal]
|
[colors.normal]
|
||||||
black = '#282828'
|
black = "#393b44"
|
||||||
red = '#cc241d'
|
red = "#c94f6d"
|
||||||
green = '#98971a'
|
green = "#81b29a"
|
||||||
yellow = '#d79921'
|
yellow = "#dbc074"
|
||||||
blue = '#458588'
|
blue = "#719cd6"
|
||||||
magenta = '#b16286'
|
magenta = "#9d79d6"
|
||||||
cyan = '#689d6a'
|
cyan = "#63cdcf"
|
||||||
white = '#a89984'
|
white = "#dfdfe0"
|
||||||
|
|
||||||
# Bright colors
|
|
||||||
[colors.bright]
|
[colors.bright]
|
||||||
black = '#928374'
|
black = "#575860"
|
||||||
red = '#fb4934'
|
red = "#d16983"
|
||||||
green = '#b8bb26'
|
green = "#8ebaa4"
|
||||||
yellow = '#fabd2f'
|
yellow = "#e0c989"
|
||||||
blue = '#83a598'
|
blue = "#86abdc"
|
||||||
magenta = '#d3869b'
|
magenta = "#baa1e2"
|
||||||
cyan = '#8ec07c'
|
cyan = "#7ad5d6"
|
||||||
white = '#ebdbb2'
|
white = "#e4e4e5"
|
||||||
|
|
||||||
|
[colors.dim]
|
||||||
|
black = "#30323a"
|
||||||
|
red = "#ab435d"
|
||||||
|
green = "#6e9783"
|
||||||
|
yellow = "#baa363"
|
||||||
|
blue = "#6085b6"
|
||||||
|
magenta = "#8567b6"
|
||||||
|
cyan = "#54aeb0"
|
||||||
|
white = "#bebebe"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# author tonsky
|
# author tonsky
|
||||||
|
|
||||||
[colors.primary]
|
[colors.primary]
|
||||||
background = '#F1F1F1' # changed
|
background = '#FFFFFF' # changed
|
||||||
foreground = '#434343'
|
foreground = '#434343'
|
||||||
|
|
||||||
[colors.cursor]
|
[colors.cursor]
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
"melange-nvim": { "branch": "master", "commit": "2db5407f2f6d6d6286f50f2f7365728d66f6f3ae" },
|
"melange-nvim": { "branch": "master", "commit": "2db5407f2f6d6d6286f50f2f7365728d66f6f3ae" },
|
||||||
"mellifluous.nvim": { "branch": "v1", "commit": "1637e46585435ebda7963248e0e65422effad8d9" },
|
"mellifluous.nvim": { "branch": "v1", "commit": "1637e46585435ebda7963248e0e65422effad8d9" },
|
||||||
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
|
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
|
||||||
|
"nano-theme.nvim": { "branch": "main", "commit": "0b1158c4911f4bd9d5a1e2e7669ebff893435b64" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
"neogit": { "branch": "master", "commit": "6d1bd94f7fca92a50a892f494920696b5defa8c8" },
|
"neogit": { "branch": "master", "commit": "6d1bd94f7fca92a50a892f494920696b5defa8c8" },
|
||||||
"nordic.nvim": { "branch": "main", "commit": "8627750ece357e9670f9e69853091f7fbb8d6523" },
|
"nordic.nvim": { "branch": "main", "commit": "8627750ece357e9670f9e69853091f7fbb8d6523" },
|
||||||
|
@ -113,10 +113,4 @@ vim.keymap.set("n", "<leader>ss", "<cmd>source ~/.config/nvim/after/plugin/luasn
|
|||||||
|
|
||||||
-- colors
|
-- colors
|
||||||
|
|
||||||
key('n', '<F6>', function()
|
key('n', '<F6>', function() require('lupan.utils').toggle_color_scheme() end, { desc = 'Toggle background' })
|
||||||
if vim.o.background == "dark" then
|
|
||||||
vim.o.background = "light"
|
|
||||||
else
|
|
||||||
vim.o.background = "dark"
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
@ -2,6 +2,12 @@ local M = {}
|
|||||||
|
|
||||||
local filename = os.getenv('HOME') .. '/.config/alacritty/alacritty.toml'
|
local filename = os.getenv('HOME') .. '/.config/alacritty/alacritty.toml'
|
||||||
|
|
||||||
|
local colorschemes = nil
|
||||||
|
|
||||||
|
function M.set_color_schemes(dark, light)
|
||||||
|
colorschemes = { dark = dark, light = light }
|
||||||
|
end
|
||||||
|
|
||||||
function M.terminalbg()
|
function M.terminalbg()
|
||||||
local ok, lines = pcall(io.lines, filename)
|
local ok, lines = pcall(io.lines, filename)
|
||||||
if ok then
|
if ok then
|
||||||
@ -14,11 +20,29 @@ function M.terminalbg()
|
|||||||
return "dark"
|
return "dark"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.update_color_scheme()
|
||||||
|
vim.o.background = M.terminalbg()
|
||||||
|
if colorschemes then
|
||||||
|
vim.cmd.colorscheme(colorschemes[vim.o.background])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.toggle_color_scheme()
|
||||||
|
if vim.o.background == "dark" then
|
||||||
|
vim.o.background = "light"
|
||||||
|
else
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
if colorschemes then
|
||||||
|
vim.cmd.colorscheme(colorschemes[vim.o.background])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local w = vim.uv.new_fs_event()
|
local w = vim.uv.new_fs_event()
|
||||||
|
|
||||||
local function watch(fname)
|
local function watch(fname)
|
||||||
w:start(filename, {}, vim.schedule_wrap(function(...)
|
w:start(filename, {}, vim.schedule_wrap(function(...)
|
||||||
vim.o.background = M.terminalbg()
|
M.update_color_scheme()
|
||||||
w:stop()
|
w:stop()
|
||||||
watch(fname)
|
watch(fname)
|
||||||
end))
|
end))
|
||||||
|
@ -11,9 +11,23 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"savq/melange-nvim",
|
"savq/melange-nvim",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'ronisbr/nano-theme.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
vim.o.background = require('lupan.utils').terminalbg()
|
local nano = require('nano-theme.colors')
|
||||||
vim.cmd.colorscheme('melange')
|
local nano_get = nano.get
|
||||||
|
function nano.get()
|
||||||
|
local t = nano_get()
|
||||||
|
local light = vim.o.background == 'light'
|
||||||
|
if not light then
|
||||||
|
t.nano_strong.fg = '#ECEFF4'
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
require('lupan.utils').set_color_schemes('nano-theme', 'nano-theme')
|
||||||
|
require('lupan.utils').update_color_scheme()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ return {
|
|||||||
harpoon = { switch = 'f' },
|
harpoon = { switch = 'f' },
|
||||||
},
|
},
|
||||||
colors = {
|
colors = {
|
||||||
file = '#5a418a',
|
file = '#EBCB8B',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user