2021-04-17 19:22:55 +00:00
|
|
|
local util = require("tokyonight.util")
|
|
|
|
local theme = require("tokyonight.theme")
|
2022-09-05 14:56:58 +00:00
|
|
|
local config = require("tokyonight.config")
|
2021-04-17 19:22:55 +00:00
|
|
|
|
2021-04-20 11:39:38 +00:00
|
|
|
local M = {}
|
|
|
|
|
2022-09-10 07:35:41 +00:00
|
|
|
function M._load(style)
|
|
|
|
if style and not M._style then
|
|
|
|
M._style = require("tokyonight.config").options.style
|
|
|
|
end
|
|
|
|
if not style and M._style then
|
|
|
|
require("tokyonight.config").options.style = M._style
|
|
|
|
M._style = nil
|
|
|
|
end
|
|
|
|
M.load({ style = style, use_background = style == nil })
|
|
|
|
end
|
|
|
|
|
2022-09-05 14:56:58 +00:00
|
|
|
---@param opts Config|nil
|
2022-09-05 14:09:28 +00:00
|
|
|
function M.load(opts)
|
|
|
|
if opts then
|
|
|
|
require("tokyonight.config").extend(opts)
|
|
|
|
end
|
2021-05-12 09:19:28 +00:00
|
|
|
util.load(theme.setup())
|
|
|
|
end
|
2021-04-20 11:39:38 +00:00
|
|
|
|
2022-09-05 14:56:58 +00:00
|
|
|
M.setup = config.setup
|
|
|
|
|
|
|
|
-- keep for backward compatibility
|
2022-09-05 14:09:28 +00:00
|
|
|
M.colorscheme = M.load
|
|
|
|
|
2021-04-20 11:39:38 +00:00
|
|
|
return M
|