docs: added more info on how to override colors and highlihgts
This commit is contained in:
13
README.md
13
README.md
@@ -161,6 +161,17 @@ require("tokyonight").setup({
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 🪓 Overriding Colors & Highlight Groups
|
||||||
|
|
||||||
|
How the highlight groups are calculated:
|
||||||
|
|
||||||
|
1. the **colors** for the style are calculated based on your config
|
||||||
|
2. `config.on_colors(colors)` is ran, where you can override the colors
|
||||||
|
3. the **colors** are then used to generate the highlight groups
|
||||||
|
4. `config.on_highlights(highlights, colors)` is ran, where you can overide the highlight groups
|
||||||
|
|
||||||
|
Please refer to default values for `colors` and `highlights` for the [storm](extras/lua_tokyonight_storm.lua), [night](extras/lua_tokyonight_night.lua), [day](extras/lua_tokyonight_day.lua)
|
||||||
|
|
||||||
Example for changing some settings and colors
|
Example for changing some settings and colors
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
@@ -169,7 +180,7 @@ require("tokyonight").setup({
|
|||||||
style = "night",
|
style = "night",
|
||||||
-- disable italic for functions
|
-- disable italic for functions
|
||||||
styles = {
|
styles = {
|
||||||
functions = "NONE"
|
functions = {}
|
||||||
},
|
},
|
||||||
sidebars = { "qf", "vista_kind", "terminal", "packer" },
|
sidebars = { "qf", "vista_kind", "terminal", "packer" },
|
||||||
-- Change the "hint" color to the "orange" color, and make the "error" color bright red
|
-- Change the "hint" color to the "orange" color, and make the "error" color bright red
|
||||||
|
|||||||
1276
extras/lua_tokyonight_day.lua
Normal file
1276
extras/lua_tokyonight_day.lua
Normal file
File diff suppressed because it is too large
Load Diff
1293
extras/lua_tokyonight_night.lua
Normal file
1293
extras/lua_tokyonight_night.lua
Normal file
File diff suppressed because it is too large
Load Diff
1293
extras/lua_tokyonight_storm.lua
Normal file
1293
extras/lua_tokyonight_storm.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ function M.setup()
|
|||||||
foot = "ini",
|
foot = "ini",
|
||||||
tilix = "json",
|
tilix = "json",
|
||||||
iterm = "itermcolors",
|
iterm = "itermcolors",
|
||||||
|
lua = "lua",
|
||||||
}
|
}
|
||||||
-- map of style to style name
|
-- map of style to style name
|
||||||
local styles = {
|
local styles = {
|
||||||
|
|||||||
28
lua/tokyonight/extra/lua.lua
Normal file
28
lua/tokyonight/extra/lua.lua
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
--- @param colors ColorScheme
|
||||||
|
function M.generate(colors)
|
||||||
|
local function deepcopy(tbl)
|
||||||
|
local ret = tbl
|
||||||
|
if type(tbl) == "table" then
|
||||||
|
ret = {}
|
||||||
|
for key, value in pairs(tbl) do
|
||||||
|
ret[key] = deepcopy(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
colors = vim.deepcopy(colors)
|
||||||
|
colors._upstream_url = nil
|
||||||
|
colors._style_name = nil
|
||||||
|
|
||||||
|
local ret = "local colors = "
|
||||||
|
.. vim.inspect(colors)
|
||||||
|
.. "\n\nlocal highlights = "
|
||||||
|
.. vim.inspect(deepcopy(require("tokyonight.theme").setup().highlights))
|
||||||
|
.. "\n"
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user