oma-lander/rendering/palette.lua
28allday 790ca87bfb Lunar Lander: complete Love2D game with Omarchy integration
Faithful recreation of Atari Lunar Lander (1979) with vector wireframe aesthetic.
Auto-detects Omarchy system theme and font on launch.

Features:
- Dynamic zoom camera (zooms in as you approach the surface)
- Procedural jagged terrain with flat landing pads (2X, 3X, 5X multipliers)
- Apollo-style wireframe lander with thrust flame
- Gravity, thrust, rotation physics
- Landing evaluation: good (speed/angle/pad check), hard, crash
- Fuel management (750 starting, +50 for good landings)
- Crash debris particles, thrust exhaust particles
- Star field background
- HUD: altitude, horizontal/vertical speed, fuel bar, score, time
- Persistent high scores with 3-letter initial entry
- Procedural sound effects (thrust, landing chimes, crash, fuel warning)
- Full-screen scaling, system font detection

Controls: Arrows/WASD rotate+thrust, Space abort, Enter start

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:42:13 +01:00

63 lines
1.9 KiB
Lua

local Palette = {}
local theme = {}
local function hexToRGB(hex)
hex = hex:gsub("#", "")
return {
tonumber(hex:sub(1,2), 16) / 255,
tonumber(hex:sub(3,4), 16) / 255,
tonumber(hex:sub(5,6), 16) / 255,
}
end
function Palette.loadFromSystem()
local path = os.getenv("HOME") .. "/.config/omarchy/current/theme/ghostty.conf"
local f = io.open(path, "r")
if not f then
theme.bg = {0, 0, 0}
theme.fg = {1, 1, 1}
theme.accent = {1, 1, 1}
for i = 0, 15 do theme["color" .. i] = {i/15, i/15, i/15} end
theme.dim = theme.color8
return
end
for line in f:lines() do
local key, val = line:match("^(%S+)%s*=%s*(#%x+)")
if key and val then
if key == "background" then theme.bg = hexToRGB(val)
elseif key == "foreground" then theme.fg = hexToRGB(val)
elseif key == "cursor-color" then theme.accent = hexToRGB(val)
end
end
local idx, hex = line:match("^palette%s*=%s*(%d+)=(#%x+)")
if idx and hex then theme["color" .. idx] = hexToRGB(hex) end
end
f:close()
theme.dim = theme.color8 or theme.color0 or {0.2, 0.2, 0.2}
for i = 0, 15 do
if not theme["color" .. i] then theme["color" .. i] = theme.fg or {1, 1, 1} end
end
if not theme.bg then theme.bg = {0, 0, 0} end
if not theme.fg then theme.fg = {1, 1, 1} end
if not theme.accent then theme.accent = theme.color12 or theme.fg end
end
function Palette.get()
return {
bg = theme.bg,
fg = theme.fg,
lander = theme.fg,
terrain = theme.color4,
pad = theme.color2 or theme.color3,
thrust = theme.accent,
explosion = theme.accent,
hud = theme.fg,
bright = theme.accent,
dim = theme.dim,
stars = theme.dim,
warning = theme.accent,
}
end
return Palette