feat: darker sidebars
This commit is contained in:
@@ -11,8 +11,8 @@ tokyonight.normal = {
|
||||
}
|
||||
|
||||
tokyonight.insert = {
|
||||
a = { bg = colors.green3, fg = colors.bg_dark },
|
||||
b = { bg = colors.fg_gutter, fg = colors.green3 },
|
||||
a = { bg = colors.green, fg = colors.bg_dark },
|
||||
b = { bg = colors.fg_gutter, fg = colors.green },
|
||||
c = c,
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ tokyonight.command = {
|
||||
}
|
||||
|
||||
tokyonight.visual = {
|
||||
a = { bg = colors.magenta, fg = colors.bg_dark },
|
||||
b = { bg = colors.fg_gutter, fg = colors.magenta },
|
||||
a = { bg = colors.blue0, fg = colors.fg },
|
||||
b = { bg = colors.fg_gutter, fg = colors.fg },
|
||||
c = c,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
---@class Config
|
||||
local config
|
||||
|
||||
-- shim vim for kitty and other generators
|
||||
vim = vim or { g = {} }
|
||||
|
||||
local function opt(key, default)
|
||||
key = "tokyonight_" .. key
|
||||
if vim.g[key] == nil then return default end
|
||||
@@ -16,6 +19,8 @@ config = {
|
||||
functionStyle = opt("italic_functions", false) and "italic" or "NONE",
|
||||
hideInactiveStatusline = opt("hide_inactive_statusline", false),
|
||||
terminalColors = opt("terminal_colors", true),
|
||||
sidebars = opt("sidebars", {}),
|
||||
dev = opt("dev", false),
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
@@ -31,8 +31,8 @@ function util.blend(fg, bg, alpha)
|
||||
return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3))
|
||||
end
|
||||
|
||||
function util.darken(hex, amount, bg) return blend(hex, bg or util.bg, math.abs(amount)) end
|
||||
function util.lighten(hex, amount, fg) return blend(hex, fg or util.fg, math.abs(amount)) end
|
||||
function util.darken(hex, amount, bg) return util.blend(hex, bg or util.bg, math.abs(amount)) end
|
||||
function util.lighten(hex, amount, fg) return util.blend(hex, fg or util.fg, math.abs(amount)) end
|
||||
|
||||
function util.highlight(group, color)
|
||||
if color.fg then util.colorsUsed[color.fg] = true end
|
||||
@@ -59,6 +59,34 @@ function util.debug(colors)
|
||||
end
|
||||
end
|
||||
|
||||
---@param config Config
|
||||
function util.autocmds(config)
|
||||
vim.cmd [[augroup TokyoNight]]
|
||||
vim.cmd [[ autocmd!]]
|
||||
if config.dev then
|
||||
vim.cmd [[ autocmd BufWritePost */lua/tokyonight/** nested colorscheme tokyonight]]
|
||||
end
|
||||
for _, sidebar in ipairs(config.sidebars) do
|
||||
if sidebar == "terminal" then
|
||||
vim.cmd [[ autocmd TermOpen * setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]]
|
||||
else
|
||||
vim.cmd([[ autocmd BufWinEnter ]] .. sidebar ..
|
||||
[[ setlocal winhighlight=Normal:NormalSB,SignColumn:SignColumnSB]])
|
||||
end
|
||||
end
|
||||
vim.cmd [[augroup end]]
|
||||
end
|
||||
|
||||
-- Simple string interpolation.
|
||||
--
|
||||
-- Example template: "${name} is ${value}"
|
||||
--
|
||||
---@param str string template string
|
||||
---@param table table key value pairs to replace in the string
|
||||
function util.template(str, table)
|
||||
return (str:gsub("($%b{})", function(w) return table[w:sub(3, -2)] or w end))
|
||||
end
|
||||
|
||||
function util.syntax(syntax) for group, colors in pairs(syntax) do util.highlight(group, colors) end end
|
||||
|
||||
---@param colors ColorScheme
|
||||
@@ -107,6 +135,7 @@ function util.load(theme)
|
||||
async = vim.loop.new_async(vim.schedule_wrap(function()
|
||||
util.terminal(theme.colors)
|
||||
util.syntax(theme.plugins)
|
||||
util.autocmds(theme.config)
|
||||
async:close()
|
||||
end))
|
||||
async:send()
|
||||
|
||||
Reference in New Issue
Block a user