refactor: simplified extra template system and added docs
This commit is contained in:
13
README.md
13
README.md
@@ -162,3 +162,16 @@ set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{25
|
|||||||
Extra color configs for **Kitty**, **Alacritty**, **Fish**, **WezTerm** and **iTerm** can be found in [extras](extras/). To use them, refer to their respective documentation.
|
Extra color configs for **Kitty**, **Alacritty**, **Fish**, **WezTerm** and **iTerm** can be found in [extras](extras/). To use them, refer to their respective documentation.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## 🔥 Contributing
|
||||||
|
|
||||||
|
Pull requests are welcome. For the `extras`, we use a simple template system that can be used to generate themes for the different styles.
|
||||||
|
|
||||||
|
How to add a new extra template:
|
||||||
|
|
||||||
|
1. create a file like `lua/tokyonight/extra/cool-app.lua`
|
||||||
|
2. add the name and output file extension to the `extras` table in `lua/tokyonight/extra/init.lua`
|
||||||
|
3. in the root directory, run `$ lua lua/tokyonight/extra/init.lua` to generate / update extra themes
|
||||||
|
4. commit the newly created themes under `extra/`
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ local util = require("tokyonight.util")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.alacritty(config)
|
--- @param colors ColorScheme
|
||||||
config = config or require("tokyonight.config")
|
function M.generate(colors)
|
||||||
config.transform_colors = true
|
|
||||||
local colors = require("tokyonight.colors").setup(config)
|
|
||||||
|
|
||||||
local alacrittyColors = {}
|
local alacrittyColors = {}
|
||||||
for k, v in pairs(colors) do
|
for k, v in pairs(colors) do
|
||||||
if type(v) == "string" then
|
if type(v) == "string" then
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ local util = require("tokyonight.util")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.fish(config)
|
--- @param colors ColorScheme
|
||||||
config = config or require("tokyonight.config")
|
function M.generate(colors)
|
||||||
config.transform_colors = true
|
|
||||||
local colors = require("tokyonight.colors").setup(config)
|
|
||||||
|
|
||||||
local fishColors = {}
|
local fishColors = {}
|
||||||
for k, v in pairs(colors) do
|
for k, v in pairs(colors) do
|
||||||
if type(v) == "string" then
|
if type(v) == "string" then
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ local function write(str, fileName)
|
|||||||
file:close()
|
file:close()
|
||||||
end
|
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" }
|
||||||
local styles = { "storm", "night", "day" }
|
local styles = { "storm", "night", "day" }
|
||||||
|
|
||||||
@@ -16,6 +17,9 @@ 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
|
||||||
write(plugin[extra](config), extra .. "_tokyonight_" .. style .. "." .. ext)
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ local util = require("tokyonight.util")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.kitty(config)
|
--- @param colors ColorScheme
|
||||||
config = config or require("tokyonight.config")
|
function M.generate(colors)
|
||||||
config.transform_colors = true
|
|
||||||
local colors = require("tokyonight.colors").setup(config)
|
|
||||||
|
|
||||||
local kitty = util.template(
|
local kitty = util.template(
|
||||||
[[
|
[[
|
||||||
# TokyoNight colors for Kitty
|
# TokyoNight colors for Kitty
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ local util = require("tokyonight.util")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.tmux(config)
|
--- @param colors ColorScheme
|
||||||
config = config or require("tokyonight.config")
|
function M.generate(colors)
|
||||||
config.transform_colors = true
|
|
||||||
local colors = require("tokyonight.colors").setup(config)
|
|
||||||
|
|
||||||
local tmux = util.template(
|
local tmux = util.template(
|
||||||
[[
|
[[
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|||||||
@@ -2,11 +2,8 @@ local util = require("tokyonight.util")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.wezterm(config)
|
--- @param colors ColorScheme
|
||||||
config = config or require("tokyonight.config")
|
function M.generate(colors)
|
||||||
config.transform_colors = true
|
|
||||||
local colors = require("tokyonight.colors").setup(config)
|
|
||||||
|
|
||||||
local kitty = util.template(
|
local kitty = util.template(
|
||||||
[[
|
[[
|
||||||
[colors]
|
[colors]
|
||||||
|
|||||||
Reference in New Issue
Block a user