Refacto palette and theme, added more colors

This commit is contained in:
2024-02-18 16:46:13 +01:00
parent 8a91acbe19
commit e4cfb6ebd0
15 changed files with 431 additions and 240 deletions

View File

@@ -0,0 +1,44 @@
---@class Palette : Colors
---@field none string
---@field fg string
---@field bg string
---@field harder_bg string
---@field softer_bg string
---@field bg_gradiant table
---@field fg_gradiant table
---@field colored_backgrounds Colors
---@field term_colors Colors
---@field gray string
local colors = require("astrobox.palette.colors")
-- TODO Split into palette and theme (float, bars)?
--- @return Palette
return function(config)
local vimbg = vim.o.background
local dark = vimbg == "dark"
local vimbg_reversed = dark and "light" or "dark"
-- Build base colors
local base = {
none = colors.none,
fg = colors.grayscale[vimbg_reversed][1],
bg = colors.bg[vimbg][config.contrast],
harder_bg = colors.bg.harder[vimbg][config.contrast],
softer_bg = colors.bg.softer[vimbg][config.contrast],
bg_gradiant = colors.grayscale[vimbg],
fg_gradiant = colors.grayscale[vimbg_reversed],
colored_backgrounds = colors.colored_backgrounds[vimbg][config.contrast],
term_colors = colors.term_colors,
gray = colors.gray,
}
-- Append colors
local palette = vim.tbl_extend("error", base, colors.colors[vimbg])
return palette
end