nix/config/sketchybar/config/colors.lua
2025-11-30 01:48:41 -06:00

103 lines
2.8 KiB
Lua

-- Color palettes for sketchybar
-- Hex colors are converted to 0xAARRGGBB format for sketchybar
local function hex_to_sketchybar(hex, alpha)
alpha = alpha or 0xff
local r, g, b = hex:match '#(%x%x)(%x%x)(%x%x)'
if not r then return 0x00000000 end
return (alpha << 24) | (tonumber(r, 16) << 16) | (tonumber(g, 16) << 8) | tonumber(b, 16)
end
local palettes = {
default = {
-- UI backgrounds
bg = '#181819',
bg_dark = '#151320',
bg_darker = '#151320',
bg_float = '#302c45',
bg_highlight = '#2b2736',
-- Foreground
fg = '#f8f8f2',
fg_dark = '#cad3f5',
fg_gutter = '#7f8490',
-- Accent colors
red = '#fd6592',
green = '#007692',
blue = '#5199ba',
yellow = '#ffff81',
magenta = '#fc7ebd',
cyan = '#7bf2de',
orange = '#f4c07b',
purple = '#796fa9',
-- Semantic
border = '#2c2e34',
},
noctis_azureus = {
-- UI backgrounds
bg = '#051b29',
bg_dark = '#041520',
bg_darker = '#030f18',
bg_float = '#07273b',
bg_highlight = '#0c3f5f',
-- Foreground
fg = '#becfda',
fg_dark = '#aec3d0',
fg_gutter = '#475e6c',
-- Accent colors
red = '#e66533',
green = '#49e9a6',
blue = '#49ace9',
yellow = '#e4b781',
magenta = '#df769b',
cyan = '#49d6e9',
orange = '#e97749',
purple = '#60b6eb',
-- Semantic
border = '#28353e',
},
}
local M = {}
function M.load(palette_name)
local palette = palettes[palette_name]
if not palette then error('Unknown palette: ' .. palette_name) end
return {
black = hex_to_sketchybar(palette.bg),
white = hex_to_sketchybar(palette.fg),
red = hex_to_sketchybar(palette.red),
green = hex_to_sketchybar(palette.green),
blue = hex_to_sketchybar(palette.blue),
yellow = hex_to_sketchybar(palette.yellow),
orange = hex_to_sketchybar(palette.orange),
magenta = hex_to_sketchybar(palette.magenta),
cyan = hex_to_sketchybar(palette.cyan),
purple = hex_to_sketchybar(palette.purple),
grey = hex_to_sketchybar(palette.fg_gutter),
dirty_white = hex_to_sketchybar(palette.fg_dark, 0xc8),
dark_grey = hex_to_sketchybar(palette.bg_float),
transparent = 0x00000000,
bar = {
bg = hex_to_sketchybar(palette.bg_darker, 0xf1),
border = hex_to_sketchybar(palette.border),
},
popup = {
bg = hex_to_sketchybar(palette.bg_darker, 0xf1),
border = hex_to_sketchybar(palette.border),
},
slider = {
bg = hex_to_sketchybar(palette.bg_darker, 0xf1),
border = hex_to_sketchybar(palette.border),
},
bg1 = hex_to_sketchybar(palette.bg_dark, 0xd3),
bg2 = hex_to_sketchybar(palette.bg_float),
with_alpha = function(color, alpha)
if alpha > 1.0 or alpha < 0.0 then return color end
return (color & 0x00ffffff) | (math.floor(alpha * 255.0) << 24)
end,
}
end
return M