Refactor to split ansi base colors out

This commit is contained in:
ViViDboarder 2025-01-08 14:09:18 -08:00
parent 0a0eaf7910
commit e4ce2b61a3
5 changed files with 87 additions and 76 deletions

View File

@ -45,8 +45,8 @@
local lush = require("lush")
local hsl = lush.hsl
local c = require("lush_theme.wombat_lush_colors").colors
local italic = require("lush_theme.wombat_lush_colors").italic
local c = require("wombat.colors").from_ansi("ansi_lush")
local italic = "italic"
-- LSP/Linters mistakenly show `undefined global` errors in the spec, they may
-- support an annotation like the following. Consult your server documentation.

View File

@ -44,7 +44,7 @@
local lush = require("lush")
local c = require("lush_theme.wombat_lush_colors").colors
local c = require("wombat.colors").from_ansi("ansi_lush")
local classic = require("lush_theme.wombat_classic")
-- LSP/Linters mistakenly show `undefined global` errors in the spec, they may

View File

@ -1,73 +0,0 @@
-- Define the base color palet for wombat
local lush = require("lush")
local hsl = lush.hsl
local c_step = 20
local M = {
italic = "italic",
colors = {},
}
local c = M.colors
c.black = hsl("#000000")
c.red = hsl("#ff786c").darken(c_step)
c.green = hsl("#95e454")
c.yellow = hsl("#efdeab")
c.blue = hsl("#6eb9f8") -- 256mod #88b8f6
c.magenta = hsl("#ee87ff")
c.cyan = hsl("#90fdf8")
c.white = hsl("#e4e0d7")
c.bright_black = hsl("#313131")
c.bright_red = hsl("#ff786c")
c.bright_green = hsl("#bde97c") -- 256mod #cae982
c.bright_yellow = hsl("#ffffd7")
c.bright_blue = c.blue.lighten(c_step)
c.bright_magenta = c.magenta.lighten(c_step)
c.bright_cyan = c.cyan.lighten(c_step)
c.bright_white = hsl("#ffffff")
-- Set some fg/bg colors
c.dark_fg = hsl("#e4e0d7")
c.dark_bg = hsl("#1e1e1e")
c.dark_fg_256mod = hsl("#e3e0d7")
c.dark_bg_256mod = hsl("#242424")
c.cursor = hsl("#bbbbbb")
c.cursor_text = hsl("#ffffff")
c.selection_background = hsl("#574b49")
c.selection_foreground = hsl("#c3c6ca")
-- Add dark color variants not in pallet
c.dark_black = c.black.darken(c_step)
c.dark_red = c.red.darken(c_step)
c.dark_green = c.bright_green.darken(c_step)
c.dark_yellow = c.yellow.darken(c_step)
c.dark_blue = c.blue.darken(c_step)
c.dark_magenta = c.magenta.darken(c_step)
c.dark_cyan = c.cyan.darken(c_step)
c.dark_white = c.white.darken(c_step)
c.orange = hsl("#e5786d")
c.darkorange = c.orange.darken(c_step)
c.purple = hsl("#d787ff")
c.violet = hsl("#b294bb")
c.grey = hsl("#574b49")
c.aqua = c.cyan
c.pink = c.bright_red.lighten(c_step)
-- A few grey scales
c.grey_1 = hsl("#c3c6ca")
c.grey_2 = hsl("#9c998e")
c.grey_3 = hsl("#636066")
c.grey_4 = hsl("#574b49")
c.grey_5 = hsl("#444444")
c.grey_6 = hsl("#32322f")
-- Other colors
c.error_red = hsl("#ff2026")
return M

37
lua/wombat/ansi_lush.lua Normal file
View File

@ -0,0 +1,37 @@
-- Define the base color palet for wombat
local lush = require("lush")
local hsl = lush.hsl
local c_step = 20
local M = {}
M.black = hsl("#000000")
M.red = hsl("#ff786c").darken(c_step)
M.green = hsl("#95e454")
M.yellow = hsl("#efdeab")
M.blue = hsl("#6eb9f8") -- 256mod #88b8f6
M.magenta = hsl("#ee87ff")
M.cyan = hsl("#90fdf8")
M.white = hsl("#e4e0d7")
M.bright_black = hsl("#313131")
M.bright_red = hsl("#ff786c")
M.bright_green = hsl("#bde97c") -- 256mod #cae982
M.bright_yellow = hsl("#ffffd7")
M.bright_blue = M.blue.lighten(c_step)
M.bright_magenta = M.magenta.lighten(c_step)
M.bright_cyan = M.cyan.lighten(c_step)
M.bright_white = hsl("#ffffff")
-- Set some fg/bg colors
M.foreground = hsl("#e4e0d7")
M.background = hsl("#1e1e1e")
M.cursor = hsl("#bbbbbb")
M.cursor_text = hsl("#ffffff")
M.selection_background = hsl("#574b49")
M.selection_foreground = hsl("#c3c6ca")
return M

47
lua/wombat/colors.lua Normal file
View File

@ -0,0 +1,47 @@
-- Define the base color palet for wombat
local M = {}
function M.from_ansi(ansi_colors_name)
local lush = require("lush")
local hsl = lush.hsl
local c_step = 20
local ansi_colors = require("wombat." .. ansi_colors_name)
local c = ansi_colors
-- Add dark color variants not in pallet
c.dark_black = c.black.darken(c_step)
c.dark_red = c.red.darken(c_step)
c.dark_green = c.green.darken(c_step)
c.dark_yellow = c.yellow.darken(c_step)
c.dark_blue = c.blue.darken(c_step)
c.dark_magenta = c.magenta.darken(c_step)
c.dark_cyan = c.cyan.darken(c_step)
c.dark_white = c.white.darken(c_step)
-- Extend pallet colors
-- TODO: See if these should be replaced with the ANSI terminal colors
c.orange = hsl("#e5786d")
c.dark_orange = c.orange.darken(c_step)
c.violet = hsl("#b294bb")
c.purple = hsl("#d787ff")
c.grey = hsl("#574b49")
c.aqua = c.cyan
c.pink = c.bright_red.lighten(c_step)
-- A few grey scales
c.grey_1 = hsl("#c3c6ca")
c.grey_2 = hsl("#9c998e")
c.grey_3 = hsl("#636066")
c.grey_4 = hsl("#574b49")
c.grey_5 = hsl("#444444")
c.grey_6 = hsl("#32322f")
-- Other colors
c.error_red = hsl("#ff2026")
return c
end
return M