Skip to content

Commit

Permalink
feat: added .Xresources
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jul 6, 2021
1 parent 0ead86a commit 50b1e71
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 13 deletions.
23 changes: 23 additions & 0 deletions extras/xresources_tokyonight_day.Xresources
Original file line number Diff line number Diff line change
@@ -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

23 changes: 23 additions & 0 deletions extras/xresources_tokyonight_night.Xresources
Original file line number Diff line number Diff line change
@@ -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

23 changes: 23 additions & 0 deletions extras/xresources_tokyonight_storm.Xresources
Original file line number Diff line number Diff line change
@@ -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

33 changes: 20 additions & 13 deletions lua/tokyonight/extra/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 38 additions & 0 deletions lua/tokyonight/extra/xresources.lua
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 50b1e71

Please sign in to comment.