From c8df406ca965337510e1d7d6cbef4f27f38cb7e1 Mon Sep 17 00:00:00 2001 From: MiSumiSumi Date: Fri, 29 Nov 2024 17:35:33 +0900 Subject: [PATCH] fix: getting color palette (#1371) --- lua/modules/utils/init.lua | 66 ++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/lua/modules/utils/init.lua b/lua/modules/utils/init.lua index 2d8de91be..1594c13da 100644 --- a/lua/modules/utils/init.lua +++ b/lua/modules/utils/init.lua @@ -56,39 +56,41 @@ local function init_palette() }) end + local fallback_palette = { + rosewater = "#DC8A78", + flamingo = "#DD7878", + mauve = "#CBA6F7", + pink = "#F5C2E7", + red = "#E95678", + maroon = "#B33076", + peach = "#FF8700", + yellow = "#F7BB3B", + green = "#AFD700", + sapphire = "#36D0E0", + blue = "#61AFEF", + sky = "#04A5E5", + teal = "#B5E8E0", + lavender = "#7287FD", + + text = "#F2F2BF", + subtext1 = "#BAC2DE", + subtext0 = "#A6ADC8", + overlay2 = "#C3BAC6", + overlay1 = "#988BA2", + overlay0 = "#6E6B6B", + surface2 = "#6E6C7E", + surface1 = "#575268", + surface0 = "#302D41", + + base = "#1D1536", + mantle = "#1C1C19", + crust = "#161320", + } + if not palette then - if vim.g.colors_name == nil then - palette = { - rosewater = "#DC8A78", - flamingo = "#DD7878", - mauve = "#CBA6F7", - pink = "#F5C2E7", - red = "#E95678", - maroon = "#B33076", - peach = "#FF8700", - yellow = "#F7BB3B", - green = "#AFD700", - sapphire = "#36D0E0", - blue = "#61AFEF", - sky = "#04A5E5", - teal = "#B5E8E0", - lavender = "#7287FD", - - text = "#F2F2BF", - subtext1 = "#BAC2DE", - subtext0 = "#A6ADC8", - overlay2 = "#C3BAC6", - overlay1 = "#988BA2", - overlay0 = "#6E6B6B", - surface2 = "#6E6C7E", - surface1 = "#575268", - surface0 = "#302D41", - - base = "#1D1536", - mantle = "#1C1C19", - crust = "#161320", - } - elseif vim.g.colors_name:find("catppuccin") then + if vim.g.colors_name == nil or (vim.g.colors_name ~= nil and not vim.g.colors_name:find("catppuccin")) then + palette = fallback_palette + else palette = require("catppuccin.palettes").get_palette() end