fix: echo and replaced all prints with it

dev
Pocco81 2 years ago
parent f9a412002f
commit f67244f8f1

@ -1,6 +1,7 @@
local M = {} local M = {}
local cnf = require("catppuccin.config").options local cnf = require("catppuccin.config").options
local echo = require("catppuccin.utils.echo")
function M.get_palette() function M.get_palette()
local flvr = vim.g.catppuccin_flavour local flvr = vim.g.catppuccin_flavour
@ -17,11 +18,7 @@ function M.get_palette()
if palette[k] then if palette[k] then
palette[k] = v palette[k] = v
else else
vim.api.nvim_echo( echo('Warning: "' .. k .. '" is not a valid catppucin palette color')
{ { 'Warning: "' .. k .. '" is not a valid catppucin palette color.', "WarningMsg" } },
true,
{}
)
end end
end end
end end

@ -8,7 +8,6 @@ local latte = require("catppuccin.core.palettes.latte")
function M.dim() function M.dim()
if cnf.dim_inactive.shade == "dark" then if cnf.dim_inactive.shade == "dark" then
print(vim.g.catppuccin_flavour)
return ucolors.vary_color( return ucolors.vary_color(
{ latte = ucolors.darken(latte.base, dim_percentage, latte.mantle) }, { latte = ucolors.darken(latte.base, dim_percentage, latte.mantle) },
ucolors.darken(cp.base, dim_percentage, cp.mantle) ucolors.darken(cp.base, dim_percentage, cp.mantle)

@ -1,21 +1,25 @@
local TITLE = "Catppuccin" local TITLE = "Catppuccin"
return function(msg, level) return function(msg, kind)
local has_notify_plugin = pcall(require, "notify") local has_notify_plugin = pcall(require, "notify")
local level = {}
if level == "error" then if kind == "error" then
level = vim.log.levels.ERROR level.log = vim.log.kinds.ERROR
elseif level == "warn" then level.type = "error"
level = vim.log.levels.WARN elseif kind == "warn" then
level.log = vim.log.kinds.WARN
level.type = "error"
else else
level = level or vim.log.levels.INFO level.log = kind or vim.log.kinds.INFO
level.type = "info"
end end
if has_notify_plugin then if has_notify_plugin then
vim.notify(msg, level, { vim.notify(msg, level.log, {
title = TITLE, title = TITLE,
}) })
else else
vim.notify(("[%s] %s"):format(TITLE, msg), level) vim.notify(("%s (%s): %s"):format(TITLE, level.type,msg), level.log)
end end
end end

Loading…
Cancel
Save