feat: day style for terminal apps

This commit is contained in:
Folke Lemaitre
2021-05-02 10:43:18 +02:00
parent 7dce3b82dc
commit 7dc6445349
10 changed files with 133 additions and 1 deletions

View File

@@ -43,7 +43,9 @@ function M.setup(config)
red1 = "#db4b4b",
git = { change = "#6183bb", add = "#449dab", delete = "#914c54", conflict = "#bb7a61" },
}
if config.style == "night" or vim.o.background == "light" then colors.bg = "#1a1b26" end
if config.style == "night" or config.style == "day" or vim.o.background == "light" then
colors.bg = "#1a1b26"
end
util.bg = colors.bg
colors.diff = {
@@ -83,6 +85,10 @@ function M.setup(config)
util.color_overrides(colors, config)
if config.transform_colors and (config.style == "day" or vim.o.background == "light") then
return util.light_colors(colors)
end
return colors
end

View File

@@ -25,6 +25,7 @@ config = {
dev = opt("dev", false),
darkFloat = opt("dark_float", true),
darkSidebar = opt("dark_sidebar", true),
transform_colors = false,
}
if config.style == "day" then vim.o.background = "light" end

View File

@@ -4,6 +4,7 @@ local M = {}
function M.alacritty(config)
config = config or require("tokyonight.config")
config.transform_colors = true
local colors = require("tokyonight.colors").setup(config)
local alacrittyColors = {}

View File

@@ -4,6 +4,7 @@ local M = {}
function M.fish(config)
config = config or require("tokyonight.config")
config.transform_colors = true
local colors = require("tokyonight.colors").setup(config)
local fishColors = {}

View File

@@ -24,3 +24,9 @@ write(kitty.kitty(config), "kitty_tokyonight_night.conf")
write(fish.fish(config), "fish_tokyonight_night.fish")
write(alacritty.alacritty(config), "alacritty_tokyonight_night.yml")
config.style = "day"
write(kitty.kitty(config), "kitty_tokyonight_day.conf")
write(fish.fish(config), "fish_tokyonight_day.fish")
write(alacritty.alacritty(config), "alacritty_tokyonight_day.yml")

View File

@@ -4,6 +4,7 @@ local M = {}
function M.kitty(config)
config = config or require("tokyonight.config")
config.transform_colors = true
local colors = require("tokyonight.colors").setup(config)
local kitty = util.template([[

View File

@@ -166,6 +166,13 @@ function util.terminal(colors)
end
end
function util.light_colors(colors)
if type(colors) == "string" then return util.getColor(colors) end
local ret = {}
for key, value in pairs(colors) do ret[key] = util.light_colors(value) end
return ret
end
---@param theme Theme
function util.load(theme)
vim.cmd("hi clear")