Merge branch 'dev' into dev

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

@ -1,18 +1,18 @@
<h3 align="center">
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/dev/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/dev/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin for NeoVim
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/dev/assets/misc/transparent.png" height="30" width="0px"/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/logos/exports/1544x1544_circle.png" width="100" alt="Logo"/><br/>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
Catppuccin for <a href="https://github.com/neovim/neovim">NeoVim</a>
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/misc/transparent.png" height="30" width="0px"/>
</h3>
<p align="center">
<a href="https://github.com/catppuccin/nvim/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/nvim?colorA=1e1e28&colorB=c9cbff&style=for-the-badge&logo=starship style=for-the-badge"></a>
<a href="https://github.com/catppuccin/nvim/issues"><img src="https://img.shields.io/github/issues/catppuccin/nvim?colorA=1e1e28&colorB=f7be95&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/nvim/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/nvim?colorA=1e1e28&colorB=b1e1a6&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/nvim/stargazers"><img src="https://img.shields.io/github/stars/catppuccin/nvim?colorA=363a4f&colorB=b7bdf8&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/nvim/issues"><img src="https://img.shields.io/github/issues/catppuccin/nvim?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/nvim/contributors"><img src="https://img.shields.io/github/contributors/catppuccin/nvim?colorA=363a4f&colorB=a6da95&style=for-the-badge"></a>
</p>
<p align="center">
<img src="https://raw.githubusercontent.com/catppuccin/nvim/dev/assets/ss.png"/>
<img src="assets/demo.png"/>
</p>
# About
@ -30,7 +30,7 @@ This port of Catppuccin is special because it was the first one and the one that
- [Feline](https://github.com/feline-nvim/feline.nvim)
- [Lualine](https://github.com/hoob3rt/lualine.nvim)
- [Nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
- [LSP Saga](https://github.com/glepnir/lspsaga.nvim)
- [LSP Saga](https://github.com/tami5/lspsaga.nvim)
- [Git signs](https://github.com/lewis6991/gitsigns.nvim)
- [Indent Blankline](https://github.com/lukas-reineke/indent-blankline.nvim)
- [Trouble](https://github.com/folke/trouble.nvim)
@ -51,6 +51,7 @@ This port of Catppuccin is special because it was the first one and the one that
- [Telekasten](https://github.com/renerocksai/telekasten.nvim)
- [Notify](https://github.com/rcarriga/nvim-notify)
- [Symbols-Outline](https://github.com/simrat39/symbols-outline.nvim)
- [Mini.nvim](https://github.com/echasnovski/mini.nvim)
## Usage
@ -86,12 +87,17 @@ transparent_background = false,
term_colors = false,
styles = {
comments = "italic",
functions = "italic",
keywords = "italic",
conditionals = "italic",
loops = "NONE",
functions = "NONE",
keywords = "NONE",
strings = "NONE",
variables = "italic",
numbers = "bold",
booleans = "bold"
variables = "NONE",
numbers = "NONE",
booleans = "NONE",
properties = "NONE",
types = "NONE",
operators = "NONE",
},
integrations = {
treesitter = true,
@ -110,6 +116,7 @@ integrations = {
information = "underline",
},
},
coc_nvim = false,
lsp_trouble = false,
cmp = true,
lsp_saga = false,
@ -144,10 +151,11 @@ integrations = {
notify = true,
telekasten = true,
symbols_outline = true,
mini = false,
}
```
The way you setup the settings on your configuration varies on whether you are using vimL for this or Lua.
The way you setup the settings on your configuration varies based on whether you are using vimL for this or Lua.
<details>
<summary>For init.lua</summary>
@ -183,16 +191,20 @@ After setting things up, you can load catppuccin like so:
```vim
" Vim Script
let g:catppuccin_flavour = "dusk"
let g:catppuccin_flavour = "frappe" " latte, frappe, macchiato, mocha
colorscheme catppuccin
```
```lua
-- Lua
vim.g.catppuccin_flavour = "storm"
vim.g.catppuccin_flavour = "frappe" -- latte, frappe, macchiato, mocha
vim.cmd[[colorscheme catppuccin]]
```
Remember that if you want to switch your Catppuccin flavour "on the fly" you may use the `:Catppuccin <flavour>` command.
> Note: the command has autocompletion enabled, so you can just press tab to cycle through the flavours
### Configuration
Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!
@ -332,6 +344,6 @@ end
&nbsp;
<p align="center"><img src="https://raw.githubusercontent.com/catppuccin/catppuccin/dev/assets/footers/gray0_ctp_on_line.svg?sanitize=true" /></p>
<p align="center">Copyright &copy; 2020-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
<p align="center"><a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=302d41&colorB=c9cbff"/></a></p>
<p align="center"><img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" /></p>
<p align="center">Copyright &copy; 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
<p align="center"><a href="https://github.com/catppuccin/catppuccin/blob/main/LICENSE"><img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=MIT&logoColor=d9e0ee&colorA=363a4f&colorB=b7bdf8"/></a></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

@ -35,6 +35,7 @@ config.options = {
information = "underline",
},
},
coc_nvim = false,
lsp_trouble = false,
cmp = true,
lsp_saga = false,
@ -64,6 +65,7 @@ config.options = {
bufferline = true,
markdown = true,
lightspeed = false,
leap = false,
ts_rainbow = false,
hop = false,
notify = true,

@ -1,27 +1,29 @@
local M = {}
function M.get(cp)
local transparent_background = require("catppuccin.config").options.transparent_background
local bg_highlight = transparent_background and "NONE" or cp.base
local inactive_bg = cp.mantle
local inactive_bg = transparent_background and "NONE" or cp.mantle
return {
BufferLineFill = { bg = cp.crust },
BufferLineBackcrust = { fg = cp.text, bg = inactive_bg }, -- others
BufferLineBufferVisible = { fg = cp.surface1, bg = inactive_bg },
BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = "bold,italic" }, -- current
BufferLineTab = { fg = cp.surface1, bg = cp.base },
BufferLineTabSelected = { fg = cp.red, bg = cp.blue },
BufferLineTabClose = { fg = cp.red, bg = inactive_bg },
BufferLineIndicatorSelected = { fg = cp.peach, bg = cp.base },
-- separators
BufferLineSeparator = { fg = inactive_bg, bg = inactive_bg },
BufferLineSeparatorVisible = { fg = inactive_bg, bg = inactive_bg },
BufferLineSeparatorSelected = { fg = inactive_bg, bg = inactive_bg },
-- close buttons
BufferLineCloseButton = { fg = cp.surface1, bg = inactive_bg },
BufferLineCloseButtonVisible = { fg = cp.surface1, bg = inactive_bg },
BufferLineCloseButtonSelected = { fg = cp.red, bg = cp.base },
}
return {
BufferLineFill = { bg = bg_highlight },
BufferLineBackcrust = { fg = cp.text, bg = inactive_bg }, -- others
BufferLineBufferVisible = { fg = cp.surface1, bg = inactive_bg },
BufferLineBufferSelected = { fg = cp.text, bg = cp.base, style = "bold,italic" }, -- current
BufferLineTab = { fg = cp.surface1, bg = cp.base },
BufferLineTabSelected = { fg = cp.red, bg = cp.blue },
BufferLineTabClose = { fg = cp.red, bg = inactive_bg },
BufferLineIndicatorSelected = { fg = cp.peach, bg = cp.base },
-- separators
BufferLineSeparator = { fg = inactive_bg, bg = inactive_bg },
BufferLineSeparatorVisible = { fg = inactive_bg, bg = inactive_bg },
BufferLineSeparatorSelected = { fg = inactive_bg, bg = inactive_bg },
-- close buttons
BufferLineCloseButton = { fg = cp.surface1, bg = inactive_bg },
BufferLineCloseButtonVisible = { fg = cp.surface1, bg = inactive_bg },
BufferLineCloseButtonSelected = { fg = cp.red, bg = cp.base },
}
end
return M

@ -0,0 +1,27 @@
local M = {}
local util = require("catppuccin.utils.util")
function M.get(cp)
local error = cp.red
local warning = cp.yellow
local info = cp.sky
local hint = cp.teal
return {
-- These groups are for the coc.nvim, the documentation is here (https://github.com/neoclide/coc.nvim/blob/master/doc/coc.txt#L2365).
CocErrorHighlight = { fg = error },
CocErrorSign = { fg = error },
CocErrorVirtualText = { fg = error },
CocHintHighlight = { fg = hint },
CocHintSign = { fg = hint },
CocHintVirtualText = { fg = hint },
CocInfoHighlight = { fg = info },
CocInfoSign = { fg = info },
CocInfoVirtualText = { fg = info },
CocWarningHighlight = { fg = warning },
CocWarningSign = { fg = warning },
}
end
return M

@ -23,10 +23,10 @@ local assets = {
slant_right_2 = "",
slant_right_2_thin = "",
chubby_dot = "",
slim_dot = '',
slim_dot = "",
}
local clrs = require("catppuccin.core.color_palette")
local clrs = require("catppuccin.core.palettes.init").get_palette()
-- settings
local sett = {
@ -62,6 +62,15 @@ local mode_colors = {
local shortline = false
local function is_enabled(is_shortline, winid, min_width)
if is_shortline then
return true
end
winid = winid or 0
return vim.api.nvim_win_get_width(winid) > min_width
end
-- Initialize the components table
local components = {
active = {},
@ -77,7 +86,7 @@ local invi_sep = {
str = " ",
hl = {
fg = sett.bkg,
bg = sett.bkg
bg = sett.bkg,
},
}
@ -85,17 +94,19 @@ local invi_sep = {
local function any_git_changes()
local gst = b.gitsigns_status_dict -- git stats
if gst then
if gst["added"] and gst["added"] > 0 or gst["removed"] and gst["removed"] > 0 or gst["changed"] and gst["changed"] > 0 then
if
gst["added"] and gst["added"] > 0
or gst["removed"] and gst["removed"] > 0
or gst["changed"] and gst["changed"] > 0
then
return true
end
end
return false
end
-- #################### STATUSLINE ->
-- ######## Left
-- Current vi mode ------>
@ -103,7 +114,7 @@ local vi_mode_hl = function()
return {
fg = sett.bkg,
bg = mode_colors[vim.fn.mode()][2],
style = "bold"
style = "bold",
}
end
@ -134,7 +145,7 @@ components.active[1][3] = {
hl = vi_mode_hl,
}
-- there is a dilema: we need to hide Diffs if ther is no git info. We can do that, but this will
-- there is a dilema: we need to hide Diffs if there is no git info. We can do that, but this will
-- leave the right_semicircle colored with purple, and since we can't change the color conditonally
-- then the solution is to create two right_semicircles: one with a mauve sett.bkg and the other one normal
-- sett.bkg; both have the same fg (vi mode). The mauve one appears if there is git info, else the one with
@ -146,12 +157,12 @@ components.active[1][4] = {
hl = function()
return {
fg = mode_colors[vim.fn.mode()][2],
bg = sett.bkg
bg = sett.bkg,
}
end,
enabled = function()
return not any_git_changes()
end
end,
}
-- enable if git diffs are available
@ -160,12 +171,12 @@ components.active[1][5] = {
hl = function()
return {
fg = mode_colors[vim.fn.mode()][2],
bg = sett.diffs
bg = sett.diffs,
}
end,
enabled = function()
return any_git_changes()
end
end,
}
-- Current vi mode ------>
@ -205,7 +216,7 @@ components.active[1][9] = {
},
enabled = function()
return any_git_changes()
end
end,
}
-- Diffs ------>
@ -230,7 +241,7 @@ components.active[1][10] = {
-- end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
left_sep = invi_sep,
}
@ -243,7 +254,7 @@ components.active[1][11] = {
-- end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
left_sep = invi_sep,
}
@ -285,12 +296,10 @@ components.active[2][1] = {
return ""
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 80
end,
enabled = is_enabled(shortline, winid, 80),
hl = {
fg = clrs.rosewater,
bg = sett.bkg
bg = sett.bkg,
},
}
@ -351,12 +360,10 @@ components.active[2][5] = {
components.active[3][1] = {
provider = "git_branch",
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 70
end,
enabled = is_enabled(shortline, winid, 70),
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
icon = "",
left_sep = invi_sep,
@ -373,7 +380,7 @@ components.active[3][2] = {
end,
hl = {
fg = sett.extras,
bg = sett.bkg
bg = sett.bkg,
},
right_sep = invi_sep,
}
@ -387,11 +394,9 @@ components.active[3][3] = {
icon = ""
return icon
end
return " " .. icon .. " " .. filename .. " "
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 70
return "%m" .. " " .. icon .. " " .. filename .. " "
end,
enabled = is_enabled(shortline, winid, 70),
hl = {
fg = sett.bkg,
bg = sett.curr_file,
@ -411,9 +416,7 @@ components.active[3][4] = {
return "" .. dir_name .. " "
end,
enabled = shortline or function(winid)
return vim.api.nvim_win_get_width(winid) > 80
end,
enabled = is_enabled(shortline, winid, 80),
hl = {
fg = sett.bkg,

@ -0,0 +1,38 @@
local M = {}
local is_prepared
local function set_prepared(val)
is_prepared = val
end
local function get_prepared()
return is_prepared
end
function M.get(cp)
if not get_prepared() then
local catppuccin = require("catppuccin")
if catppuccin.after_loading ~= nil then
catppuccin.after_loading = function ()
catppuccin.after_loading()
require'leap'.init_highlight(true)
end
else
catppuccin.after_loading = function ()
require'leap'.init_highlight(true)
end
end
set_prepared(true)
end
return {
LeapLabelPrimary = {bg = cp.surface1, fg = cp.text},
LeapLabelSecondary = {bg = cp.surface1, fg = cp.text},
LeapBackdrop = {bg = cp.base, fg = cp.overlay0},
LeapMatch = {bg = cp.base, fg = cp.red, style = "underline"},
}
end
return M

@ -15,8 +15,9 @@ function M.get(cp)
if not get_prepared() then
local catppuccin = require("catppuccin")
if catppuccin.after_loading ~= nil then
local callback = catppuccin.after_loading
catppuccin.after_loading = function ()
catppuccin.after_loading()
callback()
require'lightspeed'.init_highlight()
end
else

@ -5,7 +5,7 @@ function M.get(cp)
DiagnosticError = { fg = cp.red },
DiagnosticWarning = { fg = cp.yellow },
DiagnosticInformation = { fg = cp.blue },
DiagnosticHint = { fg = cp.hint },
DiagnosticHint = { fg = cp.rosewater },
LspFloatWinNormal = { bg = cp.crust },
LspFloatWinBorder = { fg = cp.blue },
LspSagaBorderTitle = { fg = cp.flamingo },
@ -14,11 +14,11 @@ function M.get(cp)
LspSagaDefPreviewBorder = { fg = cp.teal },
LspSagaCodeActionBorder = { fg = cp.blue },
LspSagaFinderSelection = { fg = cp.surface1 },
LspSagaCodeActionTitle = { fg = cp.blue1 },
LspSagaCodeActionContent = { fg = cp.purple },
LspSagaCodeActionTitle = { fg = cp.blue },
LspSagaCodeActionContent = { fg = cp.lavender },
LspSagaSignatureHelpBorder = { fg = cp.red },
ReferencesCount = { fg = cp.purple },
DefinitionCount = { fg = cp.purple },
ReferencesCount = { fg = cp.lavender },
DefinitionCount = { fg = cp.lavender },
DefinitionIcon = { fg = cp.blue },
ReferencesIcon = { fg = cp.blue },
TargetWord = { fg = cp.flamingo },

@ -0,0 +1,62 @@
local M = {}
function M.get(cp)
local transparent_background = require("catppuccin.config").options.transparent_background
local bg_highlight = transparent_background and "NONE" or cp.base
local inactive_bg = transparent_background and "NONE" or cp.mantle
return {
MiniCompletionActiveParameter = { style = "underline" },
MiniCursorword = { style = "underline" },
MiniCursorwordCurrent = { style = "underline" },
MiniIndentscopeSymbol = { fg = cp.text },
MiniIndentscopePrefix = { style = "nocombine" }, -- Make it invisible
MiniJump = { fg = cp.overlay2, bg = cp.pink },
MiniJump2dSpot = { bg = cp.base, fg = cp.peach, style = "bold,underline" },
MiniStarterCurrent = {},
MiniStarterFooter = { fg = cp.yellow, style = "italic" },
MiniStarterHeader = { fg = cp.blue },
MiniStarterInactive = { fg = cp.surface2, style = cnf.styles.comments },
MiniStarterItem = { fg = cp.text },
MiniStarterItemBullet = { fg = cp.blue },
MiniStarterItemPrefix = { fg = cp.pink },
MiniStarterSection = { fg = cp.flamingo },
MiniStarterQuery = { fg = cp.green },
MiniStatuslineDevinfo = { fg = cp.subtext1, bg = cp.surface1 },
MiniStatuslineFileinfo = { fg = cp.subtext1, bg = cp.surface1 },
MiniStatuslineFilename = { fg = cp.text, bg = cp.mantle },
MiniStatuslineInactive = { fg = cp.blue, bg = cp.mantle },
MiniStatuslineModeCommand = { fg = cp.base, bg = cp.peach, style = "bold" },
MiniStatuslineModeInsert = { fg = cp.base, bg = cp.green, style = "bold" },
MiniStatuslineModeNormal = { fg = cp.mantle, bg = cp.blue, style = "bold" },
MiniStatuslineModeOther = { fg = cp.base, bg = cp.teal, style = "bold" },
MiniStatuslineModeReplace = { fg = cp.base, bg = cp.red, style = "bold" },
MiniStatuslineModeVisual = { fg = cp.base, bg = cp.mauve, style = "bold" },
MiniSurround = { bg = cp.pink, fg = cp.surface1 },
MiniTablineCurrent = { fg = cp.text, bg = cp.base, style = "bold,italic" },
MiniTablineFill = { bg = bg_highlight },
MiniTablineHidden = { fg = cp.text, bg = inactive_bg },
MiniTablineModifiedCurrent = { fg = cp.base, bg = cp.text, style = "bold,italic" },
MiniTablineModifiedHidden = { fg = inactive_bg, bg = cp.text },
MiniTablineModifiedVisible = { fg = cp.surface1, bg = cp.subtext1 },
MiniTablineTabpagesection = { fg = cp.surface1, bg = cp.base },
MiniTablineVisible = { fg = cp.subtext1, bg = cp.surface1 },
MiniTestEmphasis = { style = "bold" },
MiniTestFail = { fg = cp.red, style = "bold" },
MiniTestPass = { fg = cp.green, style = "bold" },
MiniTrailspace = { bg = cp.red },
}
end
return M

@ -1,10 +1,11 @@
local M = {}
local util = require("catppuccin.utils.util")
local ucolors = require("catppuccin.utils.colors")
function M.get(cp)
local virtual_text = cnf.integrations.native_lsp.virtual_text
local underlines = cnf.integrations.native_lsp.underlines
local options = require("catppuccin.config").options
local virtual_text = options.integrations.native_lsp.virtual_text
local underlines = options.integrations.native_lsp.underlines
local error = cp.red
local warning = cp.yellow
@ -20,11 +21,16 @@ function M.get(cp)
LspReferenceRead = { bg = cp.surface1 }, -- used for highlighting "read" references
LspReferenceWrite = { bg = cp.surface1 }, -- used for highlighting "write" references
-- hightlight diagnostics in numberline
DiagnosticError = { bg = util.darken(error, darkening_percentage, cp.base), fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticWarn = { bg = util.darken(warning, darkening_percentage, cp.base), fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticInfo = { bg = util.darken(info, darkening_percentage, cp.base), fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticHint = { bg = util.darken(hint, darkening_percentage, cp.base), fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
-- util.
DiagnosticVirtualTextError = { bg = util.darken(error, darkening_percentage, cp.base), fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextWarn = { bg = util.darken(warning, darkening_percentage, cp.base), fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextInfo = { bg = util.darken(info, darkening_percentage, cp.base), fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextHint = { bg = util.darken(hint, darkening_percentage, cp.base), fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticError = { bg = cp.none, fg = error, style = virtual_text.errors }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticWarn = { bg = cp.none, fg = warning, style = virtual_text.warnings }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticInfo = { bg = cp.none, fg = info, style = virtual_text.information }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
DiagnosticHint = { bg = cp.none, fg = hint, style = virtual_text.hints }, -- Used as the mantle highlight group. Other Diagnostic highlights link to this by default
-- for nvim nightly
DiagnosticUnderlineError = { style = underlines.errors, sp = error },

@ -106,7 +106,7 @@ function M.get(cp)
tsxTSTagAttribute = { fg = cp.mauve },
-- cpp
cppTSProperty = { fg = cp.text },
cppTSProperty = { fg = cp.rosewater },
-- yaml
yamlTSField = { fg = cp.blue }, -- For fields.

@ -1,5 +1,4 @@
local colors_util = require("catppuccin.utils.colors")
local util = require("catppuccin.utils.util")
local ucolors = require("catppuccin.utils.colors")
local cp
local M = {}
@ -10,7 +9,7 @@ local function get_properties()
background = "dark",
}
if colors_util.assert_brightness(cp.base) then
if ucolors.assert_brightness(cp.base) then
props["background"] = "light"
end
@ -38,7 +37,12 @@ local function get_base()
lCursor = { fg = cp.base, bg = cp.text }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
CursorIM = { fg = cp.base, bg = cp.text }, -- like Cursor, but used when in IME mode |CursorIM|
CursorColumn = { bg = cp.mantle }, -- Screen-column at the cursor, when 'cursorcolumn' is secp.
CursorLine = { bg = colors_util.vary_color({latte = util.lighten(cp.mantle, 0.70, cp.base)}, util.darken(cp.surface0, 0.64, cp.base)) }, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if forecrust (ctermfg OR guifg) is not secp.
CursorLine = {
bg = ucolors.vary_color(
{ latte = ucolors.lighten(cp.mantle, 0.70, cp.base) },
ucolors.darken(cp.surface0, 0.64, cp.base)
),
}, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if forecrust (ctermfg OR guifg) is not secp.
Directory = { fg = cp.blue }, -- directory names (and other special names in listings)
EndOfBuffer = { fg = cp.base }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
ErrorMsg = { fg = cp.red, style = "bold,italic" }, -- error messages on the command line
@ -48,8 +52,7 @@ local function get_base()
SignColumn = { bg = cnf.transparent_background and cp.none or cp.base, fg = cp.surface1 }, -- column where |signs| are displayed
SignColumnSB = { bg = cp.crust, fg = cp.surface1 }, -- column where |signs| are displayed
Substitute = { bg = cp.surface1, fg = cp.pink }, -- |:substitute| replacement text highlighting
LineNr = { fg = colors_util.vary_color({ latte = cp.base0 }, cp.surface1) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp.
LineNr = { fg = cp.surface1 }, -- colors_util.vary_color({latte = cp.crust}, cp.surface1) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp.
LineNr = { fg = ucolors.vary_color({ latte = cp.base0 }, cp.surface1) }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp.
CursorLineNr = { fg = cp.lavender }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. highlights the number in numberline.
MatchParen = { fg = cp.peach, style = "bold" }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
ModeMsg = { fg = cp.text, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ")
@ -87,6 +90,7 @@ local function get_base()
WarningMsg = { fg = cp.yellow }, -- warning messages
Whitespace = { fg = cp.surface1 }, -- "nbsp", "space", "tab" and "trail" in 'listchars'
WildMenu = { bg = cp.overlay0 }, -- current match in 'wildmenu' completion
WinBar = { fg = cp.rosewater },
-- These groups are not listed as default vim groups,
-- but they are defacto standard group names for syntax highlighting.
-- overlay0ed out groups should chain up to their "preferred" group by

@ -15,18 +15,18 @@ local color_palette = {
green = "#A6D189",
teal = "#81C8BE",
sky = "#99D1DB",
blue = "#8CAAEE",
sapphire = "#85C1DC",
lavender = "#BFB7E4",
blue = "#8CAAEE",
lavender = "#BABBF1",
text = "#C6CEEF",
subtext1 = "#B5BDDC",
subtext0 = "#A5ACC9",
overlay2 = "#949BB7",
overlay1 = "#838AA4",
overlay0 = "#737891",
surface2 = "#62677E",
surface1 = "#51566C",
text = "#D1D9F8",
subtext1 = "#B5BFE2",
subtext0 = "#A5ADCE",
overlay2 = "#949CBB",
overlay1 = "#838BA7",
overlay0 = "#737994",
surface2 = "#626880",
surface1 = "#51576D",
surface0 = "#414559",
base = "#303446",

@ -4,19 +4,19 @@
-- analogous 2: https://coolors.co/7287fd-2a6ef5-04a5e5-e49320-209fb5-40a02b-179299
local color_palette = {
rosewater = "#DE9584",
rosewater = "#dc8a78",
flamingo = "#DD7878",
pink = "#EC83D0",
pink = "#ea76cb",
mauve = "#8839EF",
red = "#D20F39",
maroon = "#E64553",
peach = "#FE640B",
yellow = "#E49320",
yellow = "#df8e1d",
green = "#40A02B",
teal = "#179299",
sky = "#04A5E5",
blue = "#2A6EF5",
sapphire = "#209FB5",
blue = "#1e66f5",
lavender = "#7287FD",
text = "#4C4F69",

@ -15,18 +15,18 @@ local color_palette = {
green = "#A6DA95",
teal = "#8BD5CA",
sky = "#91D7E3",
blue = "#86AEF8",
sapphire = "#7DC4E4",
lavender = "#B9BEF8",
blue = "#8AADF4",
lavender = "#B7BDF8",
text = "#C5CFF5",
subtext1 = "#B3BCE0",
subtext0 = "#A1AACB",
overlay2 = "#8F97B7",
overlay1 = "#7D84A2",
overlay0 = "#6C728D",
surface2 = "#5A5F78",
surface1 = "#484C64",
text = "#CAD3F5",
subtext1 = "#B8C0E0",
subtext0 = "#A5ADCB",
overlay2 = "#939AB7",
overlay1 = "#8087A2",
overlay0 = "#6E738D",
surface2 = "#5B6078",
surface1 = "#494D64",
surface0 = "#363A4F",
base = "#24273A",

@ -1,35 +0,0 @@
-- NOTE: references for Catppuccin Moccha
-- monochromatic: https://coolors.co/c6d0f5-aeb7d9-969dbc-7e84a0-666a83-4e5167-36374a-1e1e2e-12121c-07070a
-- analogous 1: https://coolors.co/f5e0dc-f2cdcd-f5c2e7-cba6f7-eba0ac-f38ba8-fab387
-- analogous 2: https://coolors.co/bfb7e4-8caaee-99d1db-e5c890-85c1dc-a6d189-81c8be
local color_palette = {
rosewater = "#F5E0DC",
flamingo = "#F2CDCD",
pink = "#F5C2E7",
mauve = "#CBA6F7",
red = "#F38BA8",
maroon = "#EBA0AC",
peach = "#FAB387",
yellow = "#F9E2AF",
green = "#A6E3A1",
teal = "#94E2D5",
sky = "#89DCEB",
blue = "#90C1FB",
sapphire = "#74C7EC",
lavender = "#B4BEFE",
text = "#C6D0F5",
overlay2 = "#AEB7D9",
overlay1 = "#969DBC",
overlay0 = "#7E84A0",
surface2 = "#666A83",
surface1 = "#4E5167",
surface0 = "#36374A",
crust = "#11111B",
mantle = "#181825",
base = "#1E1E2E",
}
return color_palette

@ -15,18 +15,18 @@ local color_palette = {
green = "#A6E3A1",
teal = "#94E2D5",
sky = "#89DCEB",
blue = "#90C1FB",
sapphire = "#74C7EC",
blue = "#89B4FA",
lavender = "#B4BEFE",
text = "#C6D0F5",
subtext1 = "#B3BCDF",
subtext0 = "#A1A8C9",
overlay2 = "#8E95B3",
overlay1 = "#7B819D",
overlay0 = "#696D86",
surface2 = "#565970",
surface1 = "#43465A",
text = "#CDD6F4",
subtext1 = "#BAC2DE",
subtext0 = "#A6ADC8",
overlay2 = "#9399B2",
overlay1 = "#7F849C",
overlay0 = "#6C7086",
surface2 = "#585B70",
surface1 = "#45475A",
surface0 = "#313244",
base = "#1E1E2E",

@ -0,0 +1,12 @@
local M = {}
function M.flavour_completion()
return vim.tbl_keys(require("catppuccin.utils.data").set_of({
"latte",
"frappe",
"macchiato",
"mocha",
}))
end
return M

@ -1,6 +1,88 @@
local M = {}
local function color_is_bright(r, g, b)
local hsluv = require("catppuccin.utils.hsluv")
---@param hex_str string hexadecimal value of a color
local hex_to_rgb = function(hex_str)
local hex = "[abcdef0-9][abcdef0-9]"
local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$"
hex_str = string.lower(hex_str)
assert(string.find(hex_str, pat) ~= nil, "hex_to_rgb: invalid hex_str: " .. tostring(hex_str))
local red, green, blue = string.match(hex_str, pat)
return { tonumber(red, 16), tonumber(green, 16), tonumber(blue, 16) }
end
---@param fg string forecrust color
---@param bg string background color
---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg
function M.blend(fg, bg, alpha)
bg = hex_to_rgb(bg)
fg = hex_to_rgb(fg)
local blendChannel = function(i)
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i]))
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3))
end
function M.darken(hex, amount, bg)
return M.blend(hex, bg or M.bg, math.abs(amount))
end
function M.lighten(hex, amount, fg)
return M.blend(hex, fg or M.fg, math.abs(amount))
end
function M.brighten(color, percentage)
local hsl = hsluv.hex_to_hsluv(color)
local larpSpace = 100 - hsl[3]
if percentage < 0 then
larpSpace = hsl[3]
end
hsl[3] = hsl[3] + larpSpace * percentage
return hsluv.hsluv_to_hex(hsl)
end
function M.invertColor(color)
if color ~= "NONE" then
local hsl = hsluv.hex_to_hsluv(color)
hsl[3] = 100 - hsl[3]
if hsl[3] < 40 then
hsl[3] = hsl[3] + (100 - hsl[3]) * M.day_brightness
end
return hsluv.hsluv_to_hex(hsl)
end
return color
end
function M.string_to_color(colors, value, default)
if not value or value == "" then
return default
end
-- If the value is a hex color code then return it
local hex = "[abcdef0-9][abcdef0-9]"
local pat = "^#" .. hex .. hex .. hex .. "$"
if string.match(value, pat) then
return value
end
local acceptable_colors = { "black", "red", "green", "blue", "magenta", "cyan", "text", "orange", "pink" }
for _, ac in ipairs(acceptable_colors) do
if string.match(value, ac) then
return colors[value]
end
end
-- Did not match anything to return default
return default
end
function M.color_is_bright(r, g, b)
-- Counting the perceptive luminance - human eye favors green color
local luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255
if luminance > 0.5 then
@ -20,7 +102,7 @@ function M.assert_brightness(color)
local g = M.hex2rgb(string.sub(hex, 3, 4))
local b = M.hex2rgb(string.sub(hex, 5, 6))
if color_is_bright(tonumber(r), tonumber(g), tonumber(b)) == true then
if M.color_is_bright(tonumber(r), tonumber(g), tonumber(b)) == true then
return true -- bright
end

@ -8,4 +8,13 @@ function M.set_of(list)
return set
end
-- https://www.codegrepper.com/code-examples/lua/lua+split+string+on+comma
function M.split(s, delimiter)
local result = {}
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
return M

@ -1,107 +1,45 @@
local hsluv = require("catppuccin.utils.hsluv")
local udata = require("catppuccin.utils.data")
local g = vim.g
local o = vim.o
local util = {}
util.bg = "#000000"
util.fg = "#ffffff"
util.day_brightness = 0.3
---@param hex_str string hexadecimal value of a color
local hex_to_rgb = function(hex_str)
local hex = "[abcdef0-9][abcdef0-9]"
local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$"
hex_str = string.lower(hex_str)
assert(string.find(hex_str, pat) ~= nil, "hex_to_rgb: invalid hex_str: " .. tostring(hex_str))
local red, green, blue = string.match(hex_str, pat)
return { tonumber(red, 16), tonumber(green, 16), tonumber(blue, 16) }
end
---@param fg string forecrust color
---@param bg string background color
---@param alpha number number between 0 and 1. 0 results in bg, 1 results in fg
function util.blend(fg, bg, alpha)
bg = hex_to_rgb(bg)
fg = hex_to_rgb(fg)
local blendChannel = function(i)
local ret = (alpha * fg[i] + ((1 - alpha) * bg[i]))
return math.floor(math.min(math.max(0, ret), 255) + 0.5)
end
local has_nvim07 = vim.fn.has("nvim-0.7")
return string.format("#%02X%02X%02X", blendChannel(1), blendChannel(2), blendChannel(3))
end
function util.darken(hex, amount, bg)
return util.blend(hex, bg or util.bg, math.abs(amount))
end
function util.lighten(hex, amount, fg)
return util.blend(hex, fg or util.fg, math.abs(amount))
end
function util.brighten(color, percentage)
local hsl = hsluv.hex_to_hsluv(color)
local larpSpace = 100 - hsl[3]
if percentage < 0 then
larpSpace = hsl[3]
end
hsl[3] = hsl[3] + larpSpace * percentage
return hsluv.hsluv_to_hex(hsl)
end
function util.invertColor(color)
if color ~= "NONE" then
local hsl = hsluv.hex_to_hsluv(color)
hsl[3] = 100 - hsl[3]
if hsl[3] < 40 then
hsl[3] = hsl[3] + (100 - hsl[3]) * util.day_brightness
function util.highlight(group, color)
if has_nvim07 then
if color.link then
vim.api.nvim_set_hl(0, group, {
link = color.link,
})
else
if color.style then
if color.style ~= "NONE" then
for _, style in pairs(udata.split(color.style, ",")) do
color[style] = true
end
end
end
color.style = nil
vim.api.nvim_set_hl(0, group, color)
end
return hsluv.hsluv_to_hex(hsl)
end
return color
end
function util.string_to_color(colors, value, default)
if not value or value == "" then
return default
end
-- If the value is a hex color code then return it
local hex = "[abcdef0-9][abcdef0-9]"
local pat = "^#" .. hex .. hex .. hex .. "$"
if string.match(value, pat) then
return value
end
local acceptable_colors = { "black", "red", "green", "blue", "magenta", "cyan", "text", "orange", "pink" }
for _, ac in ipairs(acceptable_colors) do
if string.match(value, ac) then
return colors[value]
else
-- Doc: :h highlight-gui
local style = color.style and "gui=" .. color.style or "gui=NONE"
local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE"
local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE"
local sp = color.sp and "guisp=" .. color.sp or ""
local blend = color.blend and "blend=" .. color.blend or ""
local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp .. " " .. blend
vim.cmd(hl)
if color.link then
vim.cmd("highlight! link " .. group .. " " .. color.link)
end
end
-- Did not match anything to return default
return default
end
function util.highlight(group, color)
-- Doc: :h highlight-gui
local style = color.style and "gui=" .. color.style or "gui=NONE"
local fg = color.fg and "guifg=" .. color.fg or "guifg=NONE"
local bg = color.bg and "guibg=" .. color.bg or "guibg=NONE"
local sp = color.sp and "guisp=" .. color.sp or ""
local blend = color.blend and "blend=" .. color.blend or ""
local hl = "highlight " .. group .. " " .. style .. " " .. fg .. " " .. bg .. " " .. sp .. " " .. blend
vim.cmd(hl)
if color.link then
vim.cmd("highlight! link " .. group .. " " .. color.link)
end
end
function util.syntax(tbl)

@ -1,4 +1,4 @@
local cp = require("catppuccin.core.color_palette")
local cp = require("catppuccin.core.palettes.init").get_palette()
local catppuccin = {}
catppuccin.normal = {

@ -1,4 +1,4 @@
local cp = require("catppuccin.core.color_palette")
local cp = require("catppuccin.core.palettes.init").get_palette()
local catppuccin = {}
catppuccin.normal = {

Loading…
Cancel
Save