From df70644d9d3f0f1473c30c059c870fc3e91c0cb6 Mon Sep 17 00:00:00 2001 From: Pocco81 Date: Tue, 17 Aug 2021 23:46:26 -0500 Subject: [PATCH] fix: bugs at init --- lua/catppuccino/color_schemes/catppuccino.lua | 166 ++++++++---------- lua/catppuccino/utils/util.lua | 8 +- 2 files changed, 82 insertions(+), 92 deletions(-) diff --git a/lua/catppuccino/color_schemes/catppuccino.lua b/lua/catppuccino/color_schemes/catppuccino.lua index 6da884d..16996b0 100644 --- a/lua/catppuccino/color_schemes/catppuccino.lua +++ b/lua/catppuccino/color_schemes/catppuccino.lua @@ -1,104 +1,92 @@ local util = require("catppuccino.utils.util") - -local M = {} - -function M.setup(config) - config = config or require("nightfox.config") - - -- References: - -- https://coolors.co/e63946-f1faee-a8dadc-457b9d-1d3557 - -- https://coolors.co/f4f1de-e07a5f-3d405b-81b29a-f2cc8f - -- https://coolors.co/264653-2a9d8f-e9c46a-f4a261-e76f51 - - -- stylua: ignore - local colors = { - none = "NONE", - bg = "#0e171c", - fg = "#CDCECF", - fg_gutter = "#3b4261", - black = "#393b44", - red = "#c94f6d", - green = "#81B29A", - yellow = "#dbc074", - blue = "#719cd6", - magenta = "#9D79D6", - cyan = "#63cdcf", - white = "#dfdfe0", - orange = "#F4A261", - pink = "#D67AD2", - black_br = "#7f8c98", - red_br = "#D6616B", - green_br = "#58cd8b", - yellow_br = "#FFE37E", - blue_br = "#84CEE4", - magenta_br = "#B8A1E3", - cyan_br = "#59F0FF", - white_br = "#F2F2F2", - orange_br = "#F6A878", - pink_br = "#DF97DB", - comment = "#526175", - git = { - add = "#70a288", - change = "#A58155", - delete = "#904A6A", - conflict = "#C07A6D" - }, - gitSigns = { - add = "#164846", - change = "#394b70", - delete = "#823c41" - } +local opts = require("catppuccino.config").options + + +local colors = { + none = "NONE", + bg = "#0e171c", + fg = "#CDCECF", + fg_gutter = "#3b4261", + black = "#393b44", + red = "#c94f6d", + green = "#81B29A", + yellow = "#dbc074", + blue = "#719cd6", + magenta = "#9D79D6", + cyan = "#63cdcf", + white = "#dfdfe0", + orange = "#F4A261", + pink = "#D67AD2", + black_br = "#7f8c98", + red_br = "#D6616B", + green_br = "#58cd8b", + yellow_br = "#FFE37E", + blue_br = "#84CEE4", + magenta_br = "#B8A1E3", + cyan_br = "#59F0FF", + white_br = "#F2F2F2", + orange_br = "#F6A878", + pink_br = "#DF97DB", + comment = "#526175", + git = { + add = "#70a288", + change = "#A58155", + delete = "#904A6A", + conflict = "#C07A6D" + }, + gitSigns = { + add = "#164846", + change = "#394b70", + delete = "#823c41" } +} - util.bg = colors.bg +util.bg = colors.bg - colors.bg_alt = util.darken(colors.bg, 0.75, "#000000") - colors.bg_highlight = util.brighten(colors.bg, 0.10) +colors.bg_alt = util.darken(colors.bg, 0.75, "#000000") +colors.bg_highlight = util.brighten(colors.bg, 0.10) - colors.fg_alt = util.darken(colors.fg, 0.80, "#000000") +colors.fg_alt = util.darken(colors.fg, 0.80, "#000000") - colors.diff = { - add = util.darken(colors.green, 0.15), - delete = util.darken(colors.red, 0.15), - change = util.darken(colors.blue, 0.15), - text = colors.blue - } - - colors.gitSigns = { - add = util.brighten(colors.gitSigns.add, 0.2), - change = util.brighten(colors.gitSigns.change, 0.2), - delete = util.brighten(colors.gitSigns.delete, 0.2) - } +colors.diff = { + add = util.darken(colors.green, 0.15), + delete = util.darken(colors.red, 0.15), + change = util.darken(colors.blue, 0.15), + text = colors.blue +} - colors.git.ignore = colors.black - colors.black = util.darken(colors.bg, 0.8, "#000000") - colors.border_highlight = colors.blue - colors.border = colors.black +colors.gitSigns = { + add = util.brighten(colors.gitSigns.add, 0.2), + change = util.brighten(colors.gitSigns.change, 0.2), + delete = util.brighten(colors.gitSigns.delete, 0.2) +} - -- Popups and statusline always get a dark background - colors.bg_popup = colors.bg_alt - colors.bg_statusline = colors.bg_alt +colors.git.ignore = colors.black +colors.black = util.darken(colors.bg, 0.8, "#000000") +colors.border_highlight = colors.blue +colors.border = colors.black - -- Sidebar and Floats are configurable - -- colors.bg_sidebar = config.darkSidebar and colors.bg_alt or colors.bg - -- colors.bg_float = config.darkFloat and colors.bg_alt or colors.bg - colors.bg_sidebar = colors.bg_alt - colors.bg_float = colors.bg_alt +-- Popups and statusline always get a dark background +colors.bg_popup = colors.bg_alt +colors.bg_statusline = colors.bg_alt - colors.bg_visual = util.darken(colors.blue, 0.2) - colors.bg_search = util.darken(colors.cyan, 0.3) - colors.fg_sidebar = colors.fg_alt +-- Sidebar and Floats are configurable +-- colors.bg_sidebar = config.darkSidebar and colors.bg_alt or colors.bg +-- colors.bg_float = config.darkFloat and colors.bg_alt or colors.bg +colors.bg_sidebar = colors.bg_alt +colors.bg_float = colors.bg_alt - colors.error = colors.red - colors.warning = colors.yellow - colors.info = colors.blue - colors.hint = colors.cyan +colors.bg_visual = util.darken(colors.blue, 0.2) +colors.bg_search = util.darken(colors.cyan, 0.3) +colors.fg_sidebar = colors.fg_alt - colors.variable = colors.white +colors.error = colors.red +colors.warning = colors.yellow +colors.info = colors.blue +colors.hint = colors.cyan - util.color_overrides(colors, config) +colors.variable = colors.white - return colors -end +util.color_overrides(colors, opts) -return M +return colors diff --git a/lua/catppuccino/utils/util.lua b/lua/catppuccino/utils/util.lua index 283cd39..6edc3f1 100644 --- a/lua/catppuccino/utils/util.lua +++ b/lua/catppuccino/utils/util.lua @@ -1,4 +1,5 @@ local hsluv = require("catppuccino.utils.hsluv") +local opts = require("catppuccino.config").options local g = vim.g local o = vim.o @@ -9,6 +10,7 @@ util.bg = "#000000" util.fg = "#ffffff" util.day_brightness = 0.3 +---@param hex_str string hexadecimal value of a color local hex_to_rgb = function(hex_str) local hex = "[abcdef0-9][abcdef0-9]" local pat = "^#(" .. hex .. ")(" .. hex .. ")(" .. hex .. ")$" @@ -169,9 +171,9 @@ function util.load(theme) util.syntax(theme.base) util.syntax(theme.plugins) - if theme.config.terminal_colors then - util.terminal(theme) - end + -- if opts.ui.terminal then + -- util.terminal(theme) + -- end end return util