feat: set cs properties

dev-doc
Pocco81 3 years ago
parent dc217296eb
commit d51be55ada

@ -1,4 +1,5 @@
local util = require("catppuccino.utils.util")
local colors_util = require("catppuccino.utils.colors")
local M = {}
@ -13,7 +14,6 @@ local function set_cs(val)
end
local function get_base()
local cpt = get_cs()
return {
@ -134,11 +134,9 @@ local function get_base()
-- debugging
debugPC = {bg = cpt.bg_sidebar}, -- used for highlighting the current line in terminal-debug
debugBreakpoint = {bg = util.darken(cpt.info, 0.1), fg = cpt.info}, -- used for breakpoint colors in terminal-debug
-- illuminate
illuminatedWord = {bg = cpt.fg_gutter},
illuminatedCurWord = {bg = cpt.fg_gutter},
-- diff
diffAdded = {fg = cpt.git.add},
diffRemoved = {fg = cpt.git.delete},
@ -148,18 +146,15 @@ local function get_base()
diffFile = {fg = cpt.blue},
diffLine = {fg = cpt.comment},
diffIndexLine = {fg = cpt.magenta},
-- git diff
DiffAdd = {fg = cpt.diff.add, bg = cpt.bg}, -- diff mode: Added line |diff.txt|
DiffChange = {fg = cpt.diff.change, bg = cpt.bg}, -- diff mode: Changed line |diff.txt|
DiffDelete = {fg = cpt.diff.delete, bg = cpt.bg}, -- diff mode: Deleted line |diff.txt|
DiffText = {fg = cpt.diff.text, bg = cpt.bg}, -- diff mode: Changed text within a changed line |diff.txt|
-- NeoVim
healthError = {fg = cpt.error},
healthSuccess = {fg = cpt.green_br},
healthWarning = {fg = cpt.warning},
-- misc
-- glyphs
@ -169,7 +164,7 @@ local function get_base()
GlyphPalette4 = {fg = cpt.blue},
GlyphPalette6 = {fg = cpt.green_br},
GlyphPalette7 = {fg = cpt.fg},
GlyphPalette9 = {fg = cpt.red},
GlyphPalette9 = {fg = cpt.red}
}
end
@ -198,6 +193,19 @@ local function get_integrations()
return final_integrations
end
local function get_properties()
local cpt = get_cs()
local props = {
termguicolors = true,
background = "light"
}
if (colors_util.assert_brightness(cpt.bg)) then
props["background"] = "dark"
end
return props
end
function M.apply(cs)
_G.cpc = require("catppuccino.config").options
@ -212,7 +220,8 @@ function M.apply(cs)
local theme = {}
theme.base = get_base()
theme.plugins = get_integrations()
theme.integrations = get_integrations()
theme.properties = get_properties()
-- uninstantiate to avoid poluting global scope and because they are not needed anymore
_G.cpc = nil

@ -114,6 +114,12 @@ function util.syntax(tbl)
end
end
function util.properties(tbl)
for property, value in pairs(tbl) do
vim.o[property] = value
end
end
function util.terminal(theme)
g.terminal_color_0 = theme.colors.black
g.terminal_color_1 = theme.colors.red
@ -140,12 +146,11 @@ function util.load(theme)
vim.cmd("syntax reset")
end
o.background = "dark"
o.termguicolors = true
g.colors_name = "catppuccino"
util.properties(theme.properties)
util.syntax(theme.base)
util.syntax(theme.plugins)
util.syntax(theme.integrations)
-- if opts.ui.terminal then
-- util.terminal(theme)

Loading…
Cancel
Save