fix: dimming feature

dev
Pocco81 2 years ago
parent d2343a27f8
commit 3682671de4

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

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

@ -4,12 +4,20 @@ local cp = require("catppuccin.core.palettes.init").get_palette()
local cnf = require("catppuccin.config").options
local dim_percentage = cnf.dim_inactive.percentage
local ucolors = require("catppuccin.utils.colors")
local latte = require("catppuccin.core.palettes.latte")
function M.dim()
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
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
return M

@ -2,6 +2,10 @@ local M = {}
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
local hex_to_rgb = function(hex_str)
local hex = "[abcdef0-9][abcdef0-9]"

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

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