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

@@ -0,0 +1,23 @@
! TokyoNight colors for Xresources
*background: #e1e2e7
*foreground: #3760bf
*color0: #e9e9ed
*color1: #f52a65
*color2: #587539
*color3: #8c6c3e
*color4: #2e7de9
*color5: #9854f1
*color6: #007197
*color7: #6172b0
*color8: #a1a6c5
*color9: #f52a65
*color10: #587539
*color11: #8c6c3e
*color12: #2e7de9
*color13: #9854f1
*color14: #007197
*color15: #3760bf

View File

@@ -0,0 +1,23 @@
! TokyoNight colors for Xresources
*background: #1a1b26
*foreground: #c0caf5
*color0: #15161E
*color1: #f7768e
*color2: #9ece6a
*color3: #e0af68
*color4: #7aa2f7
*color5: #bb9af7
*color6: #7dcfff
*color7: #a9b1d6
*color8: #414868
*color9: #f7768e
*color10: #9ece6a
*color11: #e0af68
*color12: #7aa2f7
*color13: #bb9af7
*color14: #7dcfff
*color15: #c0caf5

View File

@@ -0,0 +1,23 @@
! TokyoNight colors for Xresources
*background: #24283b
*foreground: #c0caf5
*color0: #1D202F
*color1: #f7768e
*color2: #9ece6a
*color3: #e0af68
*color4: #7aa2f7
*color5: #bb9af7
*color6: #7dcfff
*color7: #a9b1d6
*color8: #414868
*color9: #f7768e
*color10: #9ece6a
*color11: #e0af68
*color12: #7aa2f7
*color13: #bb9af7
*color14: #7dcfff
*color15: #c0caf5

View File

@@ -3,23 +3,30 @@ package.path = "./lua/?/init.lua;./lua/?.lua"
local config = require("tokyonight.config") local config = require("tokyonight.config")
local function write(str, fileName) local function write(str, fileName)
print("[write] extra/" .. fileName) print("[write] extra/" .. fileName)
local file = io.open("extras/" .. fileName, "w") local file = io.open("extras/" .. fileName, "w")
file:write(str) file:write(str)
file:close() file:close()
end end
-- map of plugin name to plugin extension -- 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" } local styles = { "storm", "night", "day" }
for extra, ext in pairs(extras) do for extra, ext in pairs(extras) do
local plugin = require("tokyonight.extra." .. extra) local plugin = require("tokyonight.extra." .. extra)
for _, style in pairs(styles) do for _, style in pairs(styles) do
config.style = style config.style = style
config = config or require("tokyonight.config") config = config or require("tokyonight.config")
config.transform_colors = true config.transform_colors = true
local colors = require("tokyonight.colors").setup(config) local colors = require("tokyonight.colors").setup(config)
write(plugin.generate(colors), extra .. "_tokyonight_" .. style .. "." .. ext) write(plugin.generate(colors), extra .. "_tokyonight_" .. style .. "." .. ext)
end end
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