From 8faded23143de5352c5c5258e3c27886eccddd95 Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Mon, 18 Apr 2022 08:25:15 -0500 Subject: [PATCH] feat: color variantion per palette --- lua/catppuccin/core/mapper.lua | 4 ++-- lua/catppuccin/core/palettes/dawn.lua | 16 ++++++++-------- lua/catppuccin/utils/colors.lua | 9 +++++++++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/lua/catppuccin/core/mapper.lua b/lua/catppuccin/core/mapper.lua index f811d1e..83349ca 100644 --- a/lua/catppuccin/core/mapper.lua +++ b/lua/catppuccin/core/mapper.lua @@ -27,7 +27,7 @@ local function get_base() lCursor = { fg = cp.black2, bg = cp.white }, -- the character under the cursor when |language-mapping| is used (see 'guicursor') CursorIM = { fg = cp.black2, bg = cp.white }, -- like Cursor, but used when in IME mode |CursorIM| CursorColumn = { bg = cp.black1 }, -- Screen-column at the cursor, when 'cursorcolumn' is secp. - CursorLine = { bg = cp.black3 }, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if foreground (ctermfg OR guifg) is not secp. + CursorLine = { bg = colors_util.vary_color({dawn = cp.black1}, cp.black3) }, -- Screen-line at the cursor, when 'cursorline' is secp. Low-priority if foreground (ctermfg OR guifg) is not secp. Directory = { fg = cp.blue }, -- directory names (and other special names in listings) EndOfBuffer = { fg = cp.black2 }, -- 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 @@ -37,7 +37,7 @@ local function get_base() SignColumn = { bg = cnf.transparent_background and cp.none or cp.black2, fg = cp.black4 }, -- column where |signs| are displayed SignColumnSB = { bg = cp.black0, fg = cp.black4 }, -- column where |signs| are displayed Substitute = { bg = cp.black4, fg = cp.pink }, -- |:substitute| replacement text highlighting - LineNr = { fg = cp.black4 }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is secp. + LineNr = { fg = colors_util.vary_color({dawn = cp.black0}, cp.black4) }, -- 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.white, style = "bold" }, -- 'showmode' message (e.g., "-- INSERT -- ") diff --git a/lua/catppuccin/core/palettes/dawn.lua b/lua/catppuccin/core/palettes/dawn.lua index 8995ed3..028c0fe 100644 --- a/lua/catppuccin/core/palettes/dawn.lua +++ b/lua/catppuccin/core/palettes/dawn.lua @@ -14,15 +14,15 @@ local color_palette = { sapphire = "#209FB5", lavender = "#7287FD", white = "#575279", - gray2 = "#6E6A8B", - gray1 = "#86819C", - gray0 = "#9D99AE", - black5 = "#B5B1BF", - black4 = "#CCC9D1", - black3 = "#E6E3E5", + gray2 = "#6C6789", + gray1 = "#817C98", + gray0 = "#9691A8", + black5 = "#AAA6B7", + black4 = "#BEBAC6", + black0 = "#D0CDD4", + black3 = "#E1DCE0", + black1 = "#ECEBEB", black2 = "#FBF8F4", - black1 = "#EDEDED", - black0 = "#D3D0D2", } return color_palette diff --git a/lua/catppuccin/utils/colors.lua b/lua/catppuccin/utils/colors.lua index 4e38058..8d894d7 100644 --- a/lua/catppuccin/utils/colors.lua +++ b/lua/catppuccin/utils/colors.lua @@ -27,4 +27,13 @@ function M.assert_brightness(color) return false -- dull end +function M.vary_color(palettes, default) + local flvr = vim.g.catppuccin_flavour + + if palettes[flvr] ~= nil then + return palettes[flvr] + end + return default +end + return M