From ea9d7ec150b446ce515f12ca852016c019439571 Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Tue, 21 Dec 2021 10:04:15 -0500 Subject: [PATCH] doc: moved extras to the bottom --- README.md | 109 ++++++++++++++++++++++++++---------------------------- 1 file changed, 52 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index af37197..39a87e2 100644 --- a/README.md +++ b/README.md @@ -282,60 +282,6 @@ colorscheme catppuccin vim.cmd[[colorscheme catppuccin]] ``` -### Extra - -#### API - -The API allows you fetch data from Catppuccin. It can be required as a Lua module: - -```lua -local cp_api = require("catppuccin.api.") -``` - -##### Modules - -- `colors` - -```lua -cp_api.get_colors() -``` - -> Returns a table where the key is the name of the color and the value is its hex value. - -#### Overwriting highlight groups - -Highlight groups can be overwritten like so: - -```lua -catppuccin.remap({ = { }, }) -``` - -Here is an example: - -```lua -local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API -catppuccin.remap({ Comment = { fg = colors.catppuccin2 }, }) -``` - -#### Hooks - -Use them to execute code at certain events. These are the ones available: - -| Function | Description | -| ------------------ | ---------------------------- | -| `before_loading()` | Before loading a colorscheme | -| `after_loading()` | After loading a colorscheme | - -They can be used like so: - -```lua -local catppuccin = require("catppuccin") - -catppuccin.before_loading = function () - print("I ran before loading Catppuccin!") -end -``` - ### Configuration Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications! @@ -396,10 +342,59 @@ integration = { } ``` -## 🙋 FAQ +### Extra + +#### API + +The API allows you fetch data from Catppuccin. It can be required as a Lua module: + +```lua +local cp_api = require("catppuccin.api.") +``` + +##### Modules + +- `colors` -- Q: **_"How can I view the doc from NeoVim?"_** - A: Use `:help catppuccin` +```lua +cp_api.get_colors() +``` + +> Returns a table where the key is the name of the color and the value is its hex value. + +#### Overwriting highlight groups + +Highlight groups can be overwritten like so: + +```lua +catppuccin.remap({ = { }, }) +``` + +Here is an example: + +```lua +local colors = require'catppuccin.api.colors'.get_colors() -- fetch colors with API +catppuccin.remap({ Comment = { fg = colors.catppuccin2 }, }) +``` + +#### Hooks + +Use them to execute code at certain events. These are the ones available: + +| Function | Description | +| ------------------ | ---------------------------- | +| `before_loading()` | Before loading a colorscheme | +| `after_loading()` | After loading a colorscheme | + +They can be used like so: + +```lua +local catppuccin = require("catppuccin") + +catppuccin.before_loading = function () + print("I ran before loading Catppuccin!") +end +``` ## 💝 Thanks to