Merge branch 'main' into main

dev
Pocco81 2 years ago committed by GitHub
commit fc47decd70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -348,6 +348,20 @@ catppuccin.before_loading = function ()
end end
``` ```
#### Autocmd
Instead of `after_loading` hook, you can use autocmd event like this:
```lua
vim.api.nvim_create_autocmd("User", {
pattern = "CatppuccinLoaded",
callback = function()
local colors = require("catppuccin.api.colors").get_colors()
-- do something with colors
end
})
```
## 💝 Thanks to ## 💝 Thanks to
- [Pocco81](https://github.com/Pocco81) - [Pocco81](https://github.com/Pocco81)

@ -72,6 +72,7 @@ config.options = {
symbols_outline = true, symbols_outline = true,
}, },
color_overrides = {} color_overrides = {}
custom_highlights = {},
} }
function config.set_options(opts) function config.set_options(opts)

@ -13,19 +13,14 @@ end
function M.get(cp) function M.get(cp)
if not get_prepared() then if not get_prepared() then
local catppuccin = require("catppuccin") set_prepared(vim.api.nvim_create_autocmd("User", {
if catppuccin.after_loading ~= nil then pattern = "CatppuccinLoaded",
local callback = catppuccin.after_loading callback = function ()
catppuccin.after_loading = function () if pcall(require, "lightspeed") then
callback() require("lightspeed").init_highlight()
require'lightspeed'.init_highlight() end
end end
else }))
catppuccin.after_loading = function ()
require'lightspeed'.init_highlight()
end
end
set_prepared(true)
end end
return { return {

@ -6,6 +6,16 @@ function M.get(cp)
TelescopeSelectionCaret = { fg = cp.flamingo }, TelescopeSelectionCaret = { fg = cp.flamingo },
TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = "bold" }, TelescopeSelection = { fg = cp.text, bg = cp.surface0, style = "bold" },
TelescopeMatching = { fg = cp.blue }, TelescopeMatching = { fg = cp.blue },
TelescopePromptPrefix = { bg = cp.crust },
TelescopePromptNormal = { bg = cp.crust},
TelescopeResultsNormal = { bg = cp.mantle},
TelescopePreviewNormal = { bg = cp.crust },
TelescopePromptBorder = { bg = cp.crust, fg = cp.crust },
TelescopeResultsBorder = { bg = cp.mantle, fg = cp.crust },
TelescopePreviewBorder = { bg = cp.crust, fg = cp.crust },
TelescopePromptTitle = { fg = cp.crust },
TelescopeResultsTitle = { fg = cp.text },
TelescopePreviewTitle = { fg = cp.crust },
} }
end end

@ -21,6 +21,8 @@ local function load()
if catppuccin.after_loading ~= nil then if catppuccin.after_loading ~= nil then
catppuccin.after_loading() catppuccin.after_loading()
end end
vim.api.nvim_exec_autocmds("User", { pattern = "CatppuccinLoaded" })
end end
function M.main(option) function M.main(option)

@ -147,12 +147,16 @@ function util.load(theme)
if vim.fn.exists("syntax_on") then if vim.fn.exists("syntax_on") then
vim.cmd("syntax reset") vim.cmd("syntax reset")
end end
local custom_highlights = require("catppuccin.config").options.custom_highlights
g.colors_name = "catppuccin" g.colors_name = "catppuccin"
util.properties(theme.properties) util.properties(theme.properties)
util.syntax(theme.base) util.syntax(theme.base)
util.syntax(theme.integrations) util.syntax(theme.integrations)
util.syntax(custom_highlights)
if require("catppuccin.config").options["term_colors"] then if require("catppuccin.config").options["term_colors"] then
util.terminal(theme.terminal) util.terminal(theme.terminal)

Loading…
Cancel
Save