From f47c6ea2260473cd3b8024e66cc509498dfb9deb Mon Sep 17 00:00:00 2001 From: anon Date: Mon, 4 Jul 2022 15:25:14 +0300 Subject: [PATCH] add warning for incorrect color keys and update documentation --- README.md | 12 ++++++++++++ lua/catppuccin/core/palettes/init.lua | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/README.md b/README.md index e063ed3..8fcda06 100644 --- a/README.md +++ b/README.md @@ -317,6 +317,18 @@ local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with catppuccin.remap({ Comment = { fg = colors.flamingo }, }) ``` +#### Overwriting colors + +Colors can be overwritten using `vim.g.catppucin_override_colors`: + +```lua +vim.g.catppuccin_override_colors = { + base = "#ff0000", + mantle = "#242424", + crust = "#474747", +} +``` + #### Hooks Use them to execute code at certain events. These are the ones available: diff --git a/lua/catppuccin/core/palettes/init.lua b/lua/catppuccin/core/palettes/init.lua index 5d88f0c..1f85101 100644 --- a/lua/catppuccin/core/palettes/init.lua +++ b/lua/catppuccin/core/palettes/init.lua @@ -12,6 +12,12 @@ function M.get_palette() for k, v in pairs(vim.g.catppuccin_override_colors) do if palette[k] then palette[k] = v + else + vim.api.nvim_echo( + { { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } }, + true, + {} + ) end end end