refactor: refactored code to better deal with the day theme
This commit is contained in:
@@ -1,40 +1,37 @@
|
||||
-- shim vim for kitty and other generators
|
||||
vim = vim or { g = {}, o = {} }
|
||||
|
||||
local function opt(key, default)
|
||||
key = "tokyonight_" .. key
|
||||
if vim.g[key] == nil then
|
||||
return default
|
||||
end
|
||||
if vim.g[key] == 0 then
|
||||
return false
|
||||
end
|
||||
return vim.g[key]
|
||||
end
|
||||
local M = {}
|
||||
|
||||
---@class Config
|
||||
local config = {
|
||||
style = opt("style", "storm"),
|
||||
dayBrightness = opt("day_brightness", 0.3),
|
||||
transparent = opt("transparent", false),
|
||||
commentStyle = opt("italic_comments", true) and "italic" or "NONE",
|
||||
keywordStyle = opt("italic_keywords", true) and "italic" or "NONE",
|
||||
functionStyle = opt("italic_functions", false) and "italic" or "NONE",
|
||||
variableStyle = opt("italic_variables", false) and "italic" or "NONE",
|
||||
hideInactiveStatusline = opt("hide_inactive_statusline", false),
|
||||
terminalColors = opt("terminal_colors", true),
|
||||
sidebars = opt("sidebars", {}),
|
||||
colors = opt("colors", {}),
|
||||
dev = opt("dev", false),
|
||||
darkFloat = opt("dark_float", true),
|
||||
darkSidebar = opt("dark_sidebar", true),
|
||||
transparentSidebar = opt("transparent_sidebar", false),
|
||||
transform_colors = false,
|
||||
lualineBold = opt("lualine_bold", false),
|
||||
local defaults = {
|
||||
style = "storm",
|
||||
styles = {
|
||||
comments = "italic",
|
||||
functions = "NONE",
|
||||
keywords = "italic",
|
||||
variables = "NONE",
|
||||
},
|
||||
colors = {},
|
||||
darkFloat = true,
|
||||
darkSidebar = true,
|
||||
dayBrightness = 0.3,
|
||||
dev = false,
|
||||
hideInactiveStatusline = false,
|
||||
lualineBold = false,
|
||||
sidebars = {},
|
||||
terminalColors = true,
|
||||
transparent = false,
|
||||
transparentSidebar = false,
|
||||
}
|
||||
|
||||
if config.style == "day" then
|
||||
vim.o.background = "light"
|
||||
---@type Config
|
||||
M.options = {}
|
||||
|
||||
function M.setup(options)
|
||||
M.options = vim.tbl_deep_extend("force", {}, defaults, options or {})
|
||||
end
|
||||
|
||||
return config
|
||||
M.setup()
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user