Merge branch 'vihu-rg/dim-inactive'

dev
Pocco81 2 years ago
commit ecf4936512

@ -82,6 +82,7 @@ Plugin 'catppuccin/nvim', {'name': 'catppuccin'}
There are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults: There are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults:
```lua ```lua
dim_inactive = false,
transparent_background = false, transparent_background = false,
term_colors = false, term_colors = false,
styles = { styles = {
@ -213,6 +214,8 @@ This settings are unrelated to any group and are independent.
- `transparent_background`: (Boolean) if true, disables setting the background color. - `transparent_background`: (Boolean) if true, disables setting the background color.
- `term_colors`: (Boolean) if true, sets terminal colors (e.g. `g:terminal_color_0`). - `term_colors`: (Boolean) if true, sets terminal colors (e.g. `g:terminal_color_0`).
- `dim_inactive`: (Boolean) if true, dims the background color of inactive
window or buffer or split.
#### Styles #### Styles

@ -4,6 +4,11 @@ local config = {}
config.options = { config.options = {
transparent_background = false, transparent_background = false,
term_colors = false, term_colors = false,
dim_inactive = {
enable = true,
shade = "dark",
percentage = 10
},
styles = { styles = {
comments = "italic", comments = "italic",
conditionals = "italic", conditionals = "italic",
@ -35,7 +40,7 @@ config.options = {
information = "underline", information = "underline",
}, },
}, },
coc_nvim = false, coc_nvim = false,
lsp_trouble = false, lsp_trouble = false,
cmp = true, cmp = true,
lsp_saga = false, lsp_saga = false,

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

@ -1,10 +1,15 @@
local M = {} local M = {}
function M.get(cp) function M.get(cp)
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 { return {
GitSignsAdd = { fg = cp.green, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Added line |diff.txt| GitSignsAdd = { fg = cp.green, bg = bg_highlight }, -- diff mode: Added line |diff.txt|
GitSignsChange = { fg = cp.yellow, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Changed line |diff.txt| GitSignsChange = { fg = cp.yellow, bg = bg_highlight }, -- diff mode: Changed line |diff.txt|
GitSignsDelete = { fg = cp.red, bg = cnf.transparent_background and cp.none or cp.base }, -- diff mode: Deleted line |diff.txt| GitSignsDelete = { fg = cp.red, bg = bg_highlight }, -- diff mode: Deleted line |diff.txt|
} }
end end

@ -1,16 +1,20 @@
local M = {} local M = {}
function M.get(cp) function M.get(cp)
local transparent_background = require("catppuccin.config").options.transparent_background local cnf = require("catppuccin.config").options
local bg_highlight = transparent_background and "NONE" or cp.base local transparent_background = cnf.transparent_background
local bg_highlight = (transparent_background and cnf.dim_inactive.enable and cp.dim)
or (transparent_background and "NONE")
or (cnf.dim_inactive.enable and cp.dim)
or cp.base
return { return {
rainbowcol1 = {bg = bg_highlight, fg = cp.red}, rainbowcol1 = { bg = bg_highlight, fg = cp.red },
rainbowcol2 = {bg = bg_highlight, fg = cp.teal}, rainbowcol2 = { bg = bg_highlight, fg = cp.teal },
rainbowcol3 = {bg = bg_highlight, fg = cp.yellow}, rainbowcol3 = { bg = bg_highlight, fg = cp.yellow },
rainbowcol4 = {bg = bg_highlight, fg = cp.blue}, rainbowcol4 = { bg = bg_highlight, fg = cp.blue },
rainbowcol5 = {bg = bg_highlight, fg = cp.pink}, rainbowcol5 = { bg = bg_highlight, fg = cp.pink },
rainbowcol6 = {bg = bg_highlight, fg = cp.flamingo}, rainbowcol6 = { bg = bg_highlight, fg = cp.flamingo },
rainbowcol7 = {bg = bg_highlight, fg = cp.green}, rainbowcol7 = { bg = bg_highlight, fg = cp.green },
} }
end end

@ -1,5 +1,5 @@
local colors_util = require("catppuccin.utils.colors") local ucolors = require("catppuccin.ucolors.ucolors")
local util = require("catppuccin.utils.util") local lui = require("catppuccin.lib.ui")
local cp local cp
local M = {} local M = {}
@ -10,7 +10,7 @@ local function get_properties()
background = "dark", background = "dark",
} }
if colors_util.assert_brightness(cp.base) then if ucolors.assert_brightness(cp.base) then
props["background"] = "light" props["background"] = "light"
end end
@ -18,8 +18,6 @@ local function get_properties()
end end
local function get_base() local function get_base()
cp.none = "NONE"
return { return {
Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments Comment = { fg = cp.surface2, style = cnf.styles.comments }, -- just comments
ColorColumn = { bg = cp.surface0 }, -- used for the columns set with 'colorcolumn' ColorColumn = { bg = cp.surface0 }, -- used for the columns set with 'colorcolumn'
@ -29,9 +27,9 @@ local function get_base()
CursorIM = { fg = cp.base, bg = cp.text }, -- like Cursor, but used when in IME mode |CursorIM| 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. CursorColumn = { bg = cp.mantle }, -- Screen-column at the cursor, when 'cursorcolumn' is secp.
CursorLine = { CursorLine = {
bg = colors_util.vary_color( bg = ucolors.vary_color(
{ latte = util.lighten(cp.mantle, 0.70, cp.base) }, { latte = ucolors.lighten(cp.mantle, 0.70, cp.base) },
util.darken(cp.surface0, 0.64, 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. }, -- 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) Directory = { fg = cp.blue }, -- directory names (and other special names in listings)
@ -43,7 +41,7 @@ local function get_base()
SignColumn = { bg = cnf.transparent_background and cp.none or cp.base, fg = cp.surface1 }, -- column where |signs| are displayed 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 SignColumnSB = { bg = cp.crust, fg = cp.surface1 }, -- column where |signs| are displayed
Substitute = { bg = cp.surface1, fg = cp.pink }, -- |:substitute| replacement text highlighting Substitute = { bg = cp.surface1, fg = cp.pink }, -- |:substitute| replacement text highlighting
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 = cp.surface1 }, -- colors_ucolors.vary_color({latte = cp.crust}, 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. 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| 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 -- ") ModeMsg = { fg = cp.text, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ")
@ -52,7 +50,13 @@ local function get_base()
MoreMsg = { fg = cp.blue }, -- |more-prompt| MoreMsg = { fg = cp.blue }, -- |more-prompt|
NonText = { fg = cp.overlay0 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|. NonText = { fg = cp.overlay0 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|.
Normal = { fg = cp.text, bg = cnf.transparent_background and cp.none or cp.base }, -- normal text Normal = { fg = cp.text, bg = cnf.transparent_background and cp.none or cp.base }, -- normal text
NormalNC = { fg = cp.text, bg = cnf.transparent_background and cp.none or cp.base }, -- normal text in non-current windows NormalNC = {
fg = cp.text,
bg = (cnf.transparent_background and cnf.dim_inactive.enable and cp.dim)
or (cnf.dim_inactive.enable and cp.dim)
or (cnf.transparent_background and cp.none)
or cp.base,
}, -- normal text in non-current windows
NormalSB = { fg = cp.text, bg = cp.crust }, -- normal text in non-current windows NormalSB = { fg = cp.text, bg = cp.crust }, -- normal text in non-current windows
NormalFloat = { fg = cp.text, bg = cp.mantle }, -- Normal text in floating windows. NormalFloat = { fg = cp.text, bg = cp.mantle }, -- Normal text in floating windows.
FloatBorder = { fg = cp.blue }, FloatBorder = { fg = cp.blue },
@ -202,11 +206,8 @@ local function get_integrations()
end end
end end
final_integrations = vim.tbl_deep_extend( final_integrations =
"force", vim.tbl_deep_extend("force", final_integrations, require("catppuccin.core.remaps").get_hig_remaps() or {})
final_integrations,
require("catppuccin.core.remaps").get_hig_remaps() or {}
)
return final_integrations return final_integrations
end end
@ -218,6 +219,9 @@ function M.apply()
_G.cnf = require("catppuccin.config").options _G.cnf = require("catppuccin.config").options
cp = require("catppuccin.core.palettes.init").get_palette() cp = require("catppuccin.core.palettes.init").get_palette()
cp.none = "NONE"
cp.dim = lui.dim()
local theme = {} local theme = {}
theme.properties = get_properties() -- nvim settings theme.properties = get_properties() -- nvim settings
theme.base = get_base() -- basic hi groups theme.base = get_base() -- basic hi groups

@ -32,6 +32,7 @@ local color_palette = {
base = "#303446", base = "#303446",
mantle = "#292C3C", mantle = "#292C3C",
crust = "#232634", crust = "#232634",
dim = "#444858",
} }
return color_palette return color_palette

@ -29,9 +29,10 @@ local color_palette = {
surface1 = "#BCC0CC", surface1 = "#BCC0CC",
surface0 = "#CCD0DA", surface0 = "#CCD0DA",
base = "#EFF1F5",
crust = "#DCE0E8", crust = "#DCE0E8",
mantle = "#E6E9EF", mantle = "#E6E9EF",
base = "#EFF1F5", dim = "#D7D8DC",
} }
return color_palette return color_palette

@ -32,6 +32,7 @@ local color_palette = {
base = "#24273A", base = "#24273A",
mantle = "#1E2030", mantle = "#1E2030",
crust = "#181926", crust = "#181926",
dim = "#393C4D",
} }
return color_palette return color_palette

@ -32,6 +32,7 @@ local color_palette = {
base = "#1E1E2E", base = "#1E1E2E",
mantle = "#181825", mantle = "#181825",
crust = "#11111B", crust = "#11111B",
dim = "#343442",
} }
return color_palette return color_palette

@ -0,0 +1,15 @@
local M = {}
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.ucolors.ucolors")
function M.dim()
if cnf.dim_inactive.shade == "dark" then
return ucolors.darken(cp.base, dim_percentage, cp.crust)
end
return ucolors.lighten(cp.base, dim_percentage, cp.surface0)
end
return M
Loading…
Cancel
Save