From 815672eb3d7a9a52df0f509de76e9030f17cb357 Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Sun, 20 Mar 2022 18:51:06 -0500 Subject: [PATCH] feat: added storm palette --- lua/catppuccin/api/colors.lua | 2 +- .../core/integrations/treesitter.lua | 32 +++++++++++-------- lua/catppuccin/core/mapper.lua | 10 +++--- lua/catppuccin/core/palettes/dawn.lua | 0 .../{color_palette.lua => palettes/dusk.lua} | 0 lua/catppuccin/core/palettes/init.lua | 12 +++++++ lua/catppuccin/core/palettes/storm.lua | 26 +++++++++++++++ 7 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 lua/catppuccin/core/palettes/dawn.lua rename lua/catppuccin/core/{color_palette.lua => palettes/dusk.lua} (100%) create mode 100644 lua/catppuccin/core/palettes/init.lua create mode 100644 lua/catppuccin/core/palettes/storm.lua diff --git a/lua/catppuccin/api/colors.lua b/lua/catppuccin/api/colors.lua index 4dc14bb..7231428 100644 --- a/lua/catppuccin/api/colors.lua +++ b/lua/catppuccin/api/colors.lua @@ -1,7 +1,7 @@ local M = {} function M.get_colors() - return require("catppuccin.core.color_palette") + return require("catppuccin.core.palettes.init").get_palette() end return M diff --git a/lua/catppuccin/core/integrations/treesitter.lua b/lua/catppuccin/core/integrations/treesitter.lua index 7ff2aaa..b0097d5 100644 --- a/lua/catppuccin/core/integrations/treesitter.lua +++ b/lua/catppuccin/core/integrations/treesitter.lua @@ -1,10 +1,10 @@ local M = {} function M.get(cp) - local delimeters = cp.gray1 + local delimeters = cp.gray2 local operators = cp.sky local cl = cp.mauve -- conditionals, loops - local keywords = cp.red + local keywords = cp.mauve local math_logic = cp.peach return { @@ -28,18 +28,18 @@ function M.get(cp) TSConstant = { fg = cp.peach }, -- For constants TSConditional = { fg = cl, style = "bold" }, -- For keywords related to conditionnals. TSRepeat = { fg = cl, style = "bold" }, -- For keywords related to loops. - TSException = { fg = cp.peach, style = cnf.styles.keywords }, -- For exception related keywords. + TSException = { fg = cp.mauve, style = cnf.styles.keywords }, -- For exception related keywords. -- builtin - TSConstBuiltin = { fg = cp.lavender, style = cnf.styles.keywords }, -- For constant that are built in the language: nil in Lua. - TSFuncBuiltin = { fg = cp.peach, style = "italic" }, -- For builtin functions: table.insert in Lua. + TSConstBuiltin = { fg = cp.teal, style = cnf.styles.keywords }, -- For constant that are built in the language: nil in Lua. + TSFuncBuiltin = { fg = cp.teal, style = "italic" }, -- For builtin functions: table.insert in Lua. TSTypeBuiltin = { fg = cp.yellow, style = "italic" }, -- For builtin types. - TSVariableBuiltin = { fg = cp.teal, style = "italic" }, -- Variable names that are defined by the languages, like this or self. + TSVariableBuiltin = { fg = cp.red, style = "italic" }, -- Variable names that are defined by the languages, like this or self. TSFunction = { fg = cp.blue, style = cnf.styles.functions }, -- For function (calls and definitions). TSFuncMacro = { fg = cp.red }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp. - TSParameter = { fg = cp.rosewater, style = "italic" }, -- For parameters of a function. - TSKeywordFunction = { fg = cp.maroon, style = cnf.styles.keywords }, -- For keywords used to define a fuction. + TSParameter = { fg = cp.yellow, style = "italic" }, -- For parameters of a function. + TSKeywordFunction = { fg = cp.red, style = cnf.styles.keywords }, -- For keywords used to define a fuction. TSKeyword = { fg = keywords, style = cnf.styles.keywords }, -- For keywords that don't fall in previous categories. TSKeywordReturn = { fg = cp.pink }, -- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. @@ -58,7 +58,7 @@ function M.get(cp) -- TSNone = { }; -- TODO: docs -- TSParameterReference= { }; -- For references to parameters of a function. tomlTSProperty = { fg = cp.blue }, -- Differentiates between string and properties - TSPunctDelimiter = { fg = cp.teal }, -- For delimiters ie: . + TSPunctDelimiter = { fg = cp.sky }, -- For delimiters ie: . TSPunctBracket = { fg = delimeters }, -- For brackets and parenthesis. TSString = { fg = cp.green }, -- For strings. TSStringRegex = { fg = cp.peach, style = cnf.styles.strings }, -- For regexes. @@ -86,15 +86,16 @@ function M.get(cp) TSStringEscape = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string. -- bash - bashTSFuncBuiltin = { fg = cp.red, style = "italic" }, - bashTSParameter = { fg = cp.yellow, style = "italic" }, + -- bashTSFuncBuiltin = { fg = cp.red, style = "italic" }, + -- bashTSParameter = { fg = cp.yellow, style = "italic" }, -- lua - luaTSField = { fg = cp.lavender }, - luaTSConstructor = { fg = cp.flamingo }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. + luaTSField = { fg = cp.rosewater }, + -- luaTSConstructor = { fg = cp.flamingo }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. + luaTSFuncBuiltin = { fg = cp.teal, style = "italic" }, -- For builtin functions: table.insert in Lua. -- java - javaTSConstant = { fg = cp.teal }, + -- javaTSConstant = { fg = cp.teal }, -- typescript typescriptTSProperty = { fg = cp.lavender, style = "italic" }, -- Same as TSField. @@ -105,6 +106,9 @@ function M.get(cp) -- cpp cppTSProperty = { fg = cp.white }, + + -- yaml + yamlTSField = { fg = cp.blue }, -- For fields. } end diff --git a/lua/catppuccin/core/mapper.lua b/lua/catppuccin/core/mapper.lua index 90131e4..a026c81 100644 --- a/lua/catppuccin/core/mapper.lua +++ b/lua/catppuccin/core/mapper.lua @@ -1,5 +1,5 @@ local colors_util = require("catppuccin.utils.colors") -local color_palette = require("catppuccin.core.color_palette") +local cp local M = {} @@ -9,7 +9,7 @@ local function get_properties() background = "dark", } - if colors_util.assert_brightness(color_palette.black2) then + if colors_util.assert_brightness(cp.black2) then props["background"] = "light" end @@ -17,7 +17,6 @@ local function get_properties() end local function get_base() - local cp = color_palette cp.none = "NONE" return { @@ -191,7 +190,7 @@ local function get_integrations() final_integrations = vim.tbl_deep_extend( "force", final_integrations, - require("catppuccin.core.integrations." .. integration).get(color_palette) + require("catppuccin.core.integrations." .. integration).get(cp) ) end end @@ -205,11 +204,12 @@ local function get_integrations() end local function get_terminal() - return color_palette + return cp end function M.apply() _G.cnf = require("catppuccin.config").options + cp = require("catppuccin.core.palettes.init").get_palette() local theme = {} theme.properties = get_properties() -- nvim settings diff --git a/lua/catppuccin/core/palettes/dawn.lua b/lua/catppuccin/core/palettes/dawn.lua new file mode 100644 index 0000000..e69de29 diff --git a/lua/catppuccin/core/color_palette.lua b/lua/catppuccin/core/palettes/dusk.lua similarity index 100% rename from lua/catppuccin/core/color_palette.lua rename to lua/catppuccin/core/palettes/dusk.lua diff --git a/lua/catppuccin/core/palettes/init.lua b/lua/catppuccin/core/palettes/init.lua new file mode 100644 index 0000000..71bd5b2 --- /dev/null +++ b/lua/catppuccin/core/palettes/init.lua @@ -0,0 +1,12 @@ +local M = {} + +function M.get_palette() + local flvr = vim.g.catppuccin_flavour + + if flvr == "dusk" or flvr == "dawn" or flvr == "storm" then + return require("catppuccin.core.palettes." .. flvr) + end + return require("catppuccin.core.palettes.dusk") +end + +return M diff --git a/lua/catppuccin/core/palettes/storm.lua b/lua/catppuccin/core/palettes/storm.lua new file mode 100644 index 0000000..554d43d --- /dev/null +++ b/lua/catppuccin/core/palettes/storm.lua @@ -0,0 +1,26 @@ +local color_palette = { + rosewater = "#F5DFDA", -- Rosewater + flamingo = "#F2CBCB", -- Flamingo -- done + mauve = "#C6A4F8", -- Mauve -- done + pink = "#F5BFE7", -- Pink -- done + red = "#F586A2", -- Red -- done + maroon = "#EB9DA4", -- Maroon -- done + peach = "#FCB081", -- Peach -- done + yellow = "#F8DEA9", -- Yellow -- done + green = "#A9E4A3", -- Green -- done + blue = "#8CB3FA", -- Blue -- done + sky = "#89DCFD", -- Sky -- done + teal = "#88DFD2", -- Teal -- done + lavender = "#C7CBFD", -- Lavender -- done + white = "#D2DAF1", -- White -- done + gray2 = "#B9C0DB", -- Gray2 + gray1 = "#6F7599", -- Gray1 + gray0 = "#5E6487", -- Gray0 + black4 = "#3E435E", -- Black4 + black3 = "#2B3045", -- Black3 + black2 = "#24273A", -- Black2 -- done + black1 = "#1F2233", -- Black1 + black0 = "#1A1B26", -- Black0 +} + +return color_palette