From 2326c8b2d217a021f7a0ddf7bf4e7c3c8322b36c Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Thu, 11 Nov 2021 20:29:59 -0800 Subject: [PATCH] feat(themes): new themes!! --- lua/cosmic/config/init.lua | 1 + lua/cosmic/core/statusline/init.lua | 20 +++--- lua/cosmic/core/theme/colors.lua | 96 +++++++++++++++++++++-------- lua/cosmic/pluginsInit.lua | 17 ++++- 4 files changed, 95 insertions(+), 39 deletions(-) diff --git a/lua/cosmic/config/init.lua b/lua/cosmic/config/init.lua index d18b174..645fbd9 100644 --- a/lua/cosmic/config/init.lua +++ b/lua/cosmic/config/init.lua @@ -7,6 +7,7 @@ end -- these settings will be merged with any settings definined in config.lua local default_config = { + theme = 'tokyonight.nvim', -- catppuccino lsp = { format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',} rename_notification = true, diff --git a/lua/cosmic/core/statusline/init.lua b/lua/cosmic/core/statusline/init.lua index 2d6dbb2..e18f4bc 100644 --- a/lua/cosmic/core/statusline/init.lua +++ b/lua/cosmic/core/statusline/init.lua @@ -18,16 +18,16 @@ local main_icon = defaults.statusline.main_icon local get_mode = function() local mode_colors = { - [110] = { 'NORMAL', colors.blue, colors.bg_highlight }, - [105] = { 'INSERT', colors.hint, colors.bg_highlight }, - [99] = { 'COMMAND', colors.orange, colors.bg_highlight }, - [116] = { 'TERMINAL', colors.blue, colors.bg_highlight }, - [118] = { 'VISUAL', colors.purple, colors.bg_highlight }, - [22] = { 'V-BLOCK', colors.purple, colors.bg_highlight }, - [86] = { 'V-LINE', colors.purple, colors.bg_highlight }, - [82] = { 'REPLACE', colors.red, colors.bg_highlight }, - [115] = { 'SELECT', colors.red, colors.bg_highlight }, - [83] = { 'S-LINE', colors.red, colors.bg_highlight }, + [110] = { 'NORMAL', colors.normal, colors.bg_highlight }, + [105] = { 'INSERT', colors.insert, colors.bg_highlight }, + [99] = { 'COMMAND', colors.command, colors.bg_highlight }, + [116] = { 'TERMINAL', colors.normal, colors.bg_highlight }, + [118] = { 'VISUAL', colors.visual, colors.bg_highlight }, + [22] = { 'V-BLOCK', colors.visual, colors.bg_highlight }, + [86] = { 'V-LINE', colors.visual, colors.bg_highlight }, + [82] = { 'REPLACE', colors.replace, colors.bg_highlight }, + [115] = { 'SELECT', colors.replace, colors.bg_highlight }, + [83] = { 'S-LINE', colors.replace, colors.bg_highlight }, } local mode_data = mode_colors[vim.fn.mode():byte()] diff --git a/lua/cosmic/core/theme/colors.lua b/lua/cosmic/core/theme/colors.lua index c1807a8..de85e11 100644 --- a/lua/cosmic/core/theme/colors.lua +++ b/lua/cosmic/core/theme/colors.lua @@ -1,29 +1,73 @@ -local ok, theme = pcall(require, 'tokyonight.colors') -if not ok then - return false +local config = require('cosmic.config') +local colors = {} + +if config.theme == 'tokyonight.nvim' then + local theme = require('tokyonight.colors') + local themeColors = theme.setup() + + colors = { + white = themeColors.fg_dark, + bg = themeColors.bg, + bg_highlight = themeColors.bg_highlight, + bg_dark = themeColors.bg_dark, + normal = themeColors.blue, + insert = themeColors.teal, + command = themeColors.orange, + visual = themeColors.magenta, + replace = themeColors.red, + diffAdd = themeColors.git.add, + diffModified = themeColors.git.change, + diffDeleted = themeColors.git.delete, + trace = themeColors.orange, + hint = themeColors.teal, + info = themeColors.green2, + error = themeColors.magenta2, + warn = themeColors.orange, + floatBorder = themeColors.border_highlight, + selection_caret = themeColors.purple, + } +elseif config.theme == 'catppuccin' then + local theme = require('catppuccin.core.color_palette') + + colors = { + white = theme.catppuccin0, + bg = theme.catppuccin12, + bg_highlight = theme.catppuccin15, + bg_dark = theme.catppuccin14, + normal = theme.catppuccin3, + insert = theme.catppuccin4, + command = theme.catppuccin5, + visual = theme.catppuccin8, + replace = theme.catppuccin2, + diffAdd = theme.catppuccin9, + diffModified = theme.catppuccin7, + diffDeleted = theme.catppuccin5, + trace = theme.catppuccin5, + hint = theme.catppuccin10, + info = theme.catppuccin7, + error = theme.catppuccin2, + warn = theme.catppuccin5, + floatBorder = theme.catppuccin12, + selection_caret = theme.catppuccin3, + } + --[[ local color_palette = { + catppuccin0 = "#F0F0F5", -- Ghost White + catppuccin1 = "#1B1624", -- Xiketic + catppuccin2 = "#EA31B5", -- Fashion Fuchsia + catppuccin3 = "#AE9AD6", -- Blue Shell + catppuccin4 = "#F0A8E4", -- Orchid Crayola + catppuccin5 = "#E28D8D", -- New York Pink + catppuccin6 = "#E7A988", -- Tumbleweed + catppuccin7 = "#ADD692", -- Granny Smith Apple + catppuccin8 = "#F0DC89", -- Megium Champagne + catppuccin9 = "#84A5CB", -- Cerulean Frost + catppuccin10 = "#B9C4E3", -- Periwinkle Crayola + catppuccin11 = "#6F6A8A", -- Rhythm + catppuccin12 = "#3e4058", -- Independence + catppuccin13 = "#0E0C13", -- Xiketic + catppuccin14 = "#221E2F", -- Raisin Black + catppuccin15 = "#312C44", -- Space Cadet +} ]] end -local themeColors = theme.setup() - -local colors = { - white = themeColors.fg_dark, - bg = themeColors.bg, - bg_highlight = themeColors.bg_highlight, - bg_dark = themeColors.bg_dark, - blue = themeColors.blue, - purple = themeColors.magenta, - orange = themeColors.orange, - trace = themeColors.orange, - hint = themeColors.teal, - red = themeColors.red, - diffAdd = themeColors.git.add, - diffModified = themeColors.git.change, - diffDeleted = themeColors.git.delete, - info = themeColors.green2, - error = themeColors.magenta2, - warn = themeColors.orange, - floatBorder = themeColors.border_highlight, - selection_caret = themeColors.purple, -} - return colors diff --git a/lua/cosmic/pluginsInit.lua b/lua/cosmic/pluginsInit.lua index 00f995a..24e9c62 100644 --- a/lua/cosmic/pluginsInit.lua +++ b/lua/cosmic/pluginsInit.lua @@ -22,6 +22,8 @@ if not vim.tbl_islist(user_plugins.disable) then user_plugins.disable = {} end +local config = require('cosmic.config') + return packer.startup(function() use({ 'wbthomason/packer.nvim', @@ -37,7 +39,16 @@ return packer.startup(function() vim.g.tokyonight_sidebars = { 'qf' } vim.cmd('color tokyonight') end, - disable = vim.tbl_contains(user_plugins.disable, 'theme'), + disable = config.theme ~= 'tokyonight.nvim', + }) + + use({ + 'Pocco81/Catppuccino.nvim', + config = function() + vim.cmd('color catppuccin') + end, + branch = 'dev-remaster', + disable = config.theme ~= 'catppuccin', }) use({ @@ -55,7 +66,7 @@ return packer.startup(function() }) vim.notify = require('notify') end, - after = 'tokyonight.nvim', + after = config.theme, disable = vim.tbl_contains(user_plugins.disable, 'notify'), }) @@ -67,7 +78,7 @@ return packer.startup(function() config = function() require('cosmic.core.statusline') end, - after = 'tokyonight.nvim', + after = config.theme, disable = vim.tbl_contains(user_plugins.disable, 'statusline'), })