Refacto palette and theme, added more colors
This commit is contained in:
170
lua/astrobox/palette/colors.lua
Normal file
170
lua/astrobox/palette/colors.lua
Normal file
@@ -0,0 +1,170 @@
|
||||
---@class Colors
|
||||
---@field red string
|
||||
---@field green string
|
||||
---@field yellow string
|
||||
---@field blue string
|
||||
---@field purple string
|
||||
---@field aqua string
|
||||
---@field orange string
|
||||
|
||||
return {
|
||||
none = "NONE",
|
||||
bg = {
|
||||
dark = {
|
||||
soft = "#32302f",
|
||||
medium = "#282828",
|
||||
hard = "#1d2021",
|
||||
},
|
||||
light = {
|
||||
soft = "#f2e5bc",
|
||||
medium = "#fbf1c7",
|
||||
hard = "#f9f5d7",
|
||||
},
|
||||
harder = {
|
||||
dark = {
|
||||
soft = "#282828",
|
||||
medium = "#1d2021",
|
||||
hard = "#171a1a",
|
||||
},
|
||||
light = {
|
||||
soft = "#fbf1c7",
|
||||
medium = "#f9f5d7",
|
||||
hard = "#faf7df",
|
||||
},
|
||||
},
|
||||
softer = {
|
||||
dark = {
|
||||
soft = "#343230",
|
||||
medium = "#32302f",
|
||||
hard = "#282828",
|
||||
},
|
||||
light = {
|
||||
soft = "#f1e3ba",
|
||||
medium = "#f2e5bc",
|
||||
hard = "#fbf1c7",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
gray = "#928374",
|
||||
|
||||
grayscale = {
|
||||
dark = {
|
||||
"#3c3836",
|
||||
"#504945",
|
||||
"#665c54",
|
||||
"#7c6f64",
|
||||
},
|
||||
light = {
|
||||
"#ebdbb2",
|
||||
"#d5c4a1",
|
||||
"#bdae93",
|
||||
"#a89984",
|
||||
},
|
||||
},
|
||||
|
||||
colors = {
|
||||
--- @type Colors
|
||||
dark = {
|
||||
red = "#fb4934",
|
||||
green = "#b8bb26",
|
||||
yellow = "#fabd2f",
|
||||
blue = "#83a598",
|
||||
purple = "#d3869b",
|
||||
aqua = "#8ec07c",
|
||||
orange = "#fe8019",
|
||||
},
|
||||
--- @type Colors
|
||||
light = {
|
||||
red = "#9d0006",
|
||||
green = "#79740e",
|
||||
yellow = "#b57614",
|
||||
blue = "#076678",
|
||||
purple = "#8f3f71",
|
||||
aqua = "#427b58",
|
||||
orange = "#af3a03",
|
||||
},
|
||||
},
|
||||
|
||||
--- @type Colors
|
||||
term_colors = {
|
||||
red = "#cc241d",
|
||||
green = "#98971a",
|
||||
yellow = "#d79921",
|
||||
blue = "#458588",
|
||||
purple = "#b16286",
|
||||
aqua = "#689d6a",
|
||||
orange = "#d65d0e",
|
||||
},
|
||||
-- Note: Lerped from colors and backgrounds.
|
||||
colored_backgrounds = {
|
||||
-- Coeff is 0.8 with exceptions
|
||||
dark = {
|
||||
--- @type Colors
|
||||
soft = {
|
||||
red = "#5a3530",
|
||||
green = "#4d4c2d",
|
||||
yellow = "#6e5a2f", -- 0.7
|
||||
blue = "#4a534f",
|
||||
purple = "#524145",
|
||||
aqua = "#444d3e",
|
||||
orange = "#5b402b",
|
||||
},
|
||||
--- @type Colors
|
||||
medium = {
|
||||
red = "#522f2a",
|
||||
green = "#454528",
|
||||
yellow = "#67552a", -- 0.7
|
||||
blue = "#434e4a",
|
||||
purple = "#4a3b3f",
|
||||
aqua = "#3c4639",
|
||||
orange = "#533a25",
|
||||
},
|
||||
--- @type Colors
|
||||
hard = {
|
||||
red = "#492825",
|
||||
green = "#3c3f22",
|
||||
yellow = "#5f4f25", -- 0.7
|
||||
blue = "#3c4845",
|
||||
purple = "#413439",
|
||||
aqua = "#344033",
|
||||
orange = "#4a331f",
|
||||
},
|
||||
},
|
||||
|
||||
-- untested
|
||||
-- 0.6 with exceptions
|
||||
light = {
|
||||
--- @type Colors
|
||||
soft = {
|
||||
red = "#d08973",
|
||||
green = "#c2b876",
|
||||
yellow = "#e0c48a",
|
||||
blue = "#acbfa8", -- 0.7
|
||||
purple = "#caa39e",
|
||||
aqua = "#acbb94",
|
||||
orange = "#d7a172",
|
||||
},
|
||||
--- @type Colors
|
||||
medium = {
|
||||
red = "#d5917a",
|
||||
green = "#c7bf7d",
|
||||
yellow = "#e6cc91",
|
||||
blue = "#b2c7af", -- 0.7
|
||||
purple = "#d0aaa5",
|
||||
aqua = "#b1c29b",
|
||||
orange = "#dda879",
|
||||
},
|
||||
--- @type Colors
|
||||
hard = {
|
||||
red = "#d49383",
|
||||
green = "#c6c187",
|
||||
yellow = "#e5cf9d",
|
||||
blue = "#b0cabb", -- 0.7
|
||||
purple = "#cfacae",
|
||||
aqua = "#b0c4a4",
|
||||
orange = "#dbaa82",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
44
lua/astrobox/palette/init.lua
Normal file
44
lua/astrobox/palette/init.lua
Normal 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
|
||||
Reference in New Issue
Block a user