feat: added .Xresources

This commit is contained in:
Folke Lemaitre
2021-07-06 16:40:18 +02:00
parent 0ead86afe3
commit 50b1e71be5
5 changed files with 127 additions and 13 deletions

View File

@@ -3,23 +3,30 @@ package.path = "./lua/?/init.lua;./lua/?.lua"
local config = require("tokyonight.config")
local function write(str, fileName)
print("[write] extra/" .. fileName)
local file = io.open("extras/" .. fileName, "w")
file:write(str)
file:close()
print("[write] extra/" .. fileName)
local file = io.open("extras/" .. fileName, "w")
file:write(str)
file:close()
end
-- map of plugin name to plugin extension
local extras = { kitty = "conf", fish = "fish", alacritty = "yml", wezterm = "toml", tmux = "tmux" }
local extras = {
kitty = "conf",
fish = "fish",
alacritty = "yml",
wezterm = "toml",
tmux = "tmux",
xresources = "Xresources",
}
local styles = { "storm", "night", "day" }
for extra, ext in pairs(extras) do
local plugin = require("tokyonight.extra." .. extra)
for _, style in pairs(styles) do
config.style = style
config = config or require("tokyonight.config")
config.transform_colors = true
local colors = require("tokyonight.colors").setup(config)
write(plugin.generate(colors), extra .. "_tokyonight_" .. style .. "." .. ext)
end
local plugin = require("tokyonight.extra." .. extra)
for _, style in pairs(styles) do
config.style = style
config = config or require("tokyonight.config")
config.transform_colors = true
local colors = require("tokyonight.colors").setup(config)
write(plugin.generate(colors), extra .. "_tokyonight_" .. style .. "." .. ext)
end
end

View File

@@ -0,0 +1,38 @@
local util = require("tokyonight.util")
local M = {}
--- @param colors ColorScheme
function M.generate(colors)
local xr = util.template(
[[
! TokyoNight colors for Xresources
*background: ${bg}
*foreground: ${fg}
*color0: ${black}
*color1: ${red}
*color2: ${green}
*color3: ${yellow}
*color4: ${blue}
*color5: ${magenta}
*color6: ${cyan}
*color7: ${fg_dark}
*color8: ${terminal_black}
*color9: ${red}
*color10: ${green}
*color11: ${yellow}
*color12: ${blue}
*color13: ${magenta}
*color14: ${cyan}
*color15: ${fg}
]],
colors
)
return xr
end
return M