fix: dimming feature

dev
Pocco81 2 years ago
parent d2343a27f8
commit 3682671de4

@ -7,7 +7,7 @@ config.options = {
dim_inactive = { dim_inactive = {
enable = true, enable = true,
shade = "dark", shade = "dark",
percentage = 10 percentage = 0.15
}, },
styles = { styles = {
comments = "italic", comments = "italic",

@ -1,16 +1,15 @@
local M = {} local M = {}
function M.get(cp) local cp = require("catppuccin.core.palettes.init").get_palette()
local cnf = require("catppuccin.config").options local cnf = require("catppuccin.config").options
local bg_highlight = (cnf.transparent_background and cnf.dim_inactive.enable and cp.dim) local dim_percentage = cnf.dim_inactive.percentage
or (cnf.transparent_background and "NONE") local ucolors = require("catppuccin.utils.colors")
or (cnf.dim_inactive.enable and cp.dim)
or cp.base function M.dim()
return { if cnf.dim_inactive.shade == "dark" then
GitSignsAdd = { fg = cp.green, bg = bg_highlight }, -- diff mode: Added line |diff.txt| return ucolors.darken(cp.base, dim_percentage, cp.mantle)
GitSignsChange = { fg = cp.yellow, bg = bg_highlight }, -- diff mode: Changed line |diff.txt| end
GitSignsDelete = { fg = cp.red, bg = bg_highlight }, -- diff mode: Deleted line |diff.txt| return ucolors.lighten(cp.surface0, dim_percentage, cp.base)
}
end end
return M return M

@ -4,12 +4,20 @@ local cp = require("catppuccin.core.palettes.init").get_palette()
local cnf = require("catppuccin.config").options local cnf = require("catppuccin.config").options
local dim_percentage = cnf.dim_inactive.percentage local dim_percentage = cnf.dim_inactive.percentage
local ucolors = require("catppuccin.utils.colors") local ucolors = require("catppuccin.utils.colors")
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
return ucolors.darken(cp.base, dim_percentage, cp.crust) print(vim.g.catppuccin_flavour)
return ucolors.vary_color(
{ latte = ucolors.darken(latte.base, dim_percentage, latte.mantle) },
ucolors.darken(cp.base, dim_percentage, cp.mantle)
)
end end
return ucolors.lighten(cp.base, dim_percentage, cp.surface0) return ucolors.vary_color(
{ latte = ucolors.lighten("#FBFCFD", dim_percentage, latte.base) },
ucolors.lighten(cp.surface0, dim_percentage, cp.base)
)
end end
return M return M

@ -2,6 +2,10 @@ local M = {}
local hsluv = require("catppuccin.utils.hsluv") local hsluv = require("catppuccin.utils.hsluv")
M.bg = "#000000"
M.fg = "#ffffff"
M.day_brightness = 0.3
---@param hex_str string hexadecimal value of a color ---@param hex_str string hexadecimal value of a color
local hex_to_rgb = function(hex_str) local hex_to_rgb = function(hex_str)
local hex = "[abcdef0-9][abcdef0-9]" local hex = "[abcdef0-9][abcdef0-9]"

@ -5,8 +5,7 @@ function! s:FlavourCompletion(...) abort
endfunction endfunction
function! s:ApplyFlavour(args) abort function! s:ApplyFlavour(args) abort
let l:flavour = matchstr(a:args[0], "[a-z]*") let g:catppuccin_flavour = matchstr(a:args[0], "[a-z]*")
let g:catppuccin_flavour = flavour
colorscheme catppuccin colorscheme catppuccin
endfunction endfunction

@ -1,3 +0,0 @@
if exists('g:loaded_catppuccin') | finish | endif
let g:loaded_catppuccin = 1
Loading…
Cancel
Save