Theme prototypes: Velvet, Evergreen, Sunset and Frost on the Simple home (design only)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
"""Four new colour themes (Paul, 11 November 2026): Velvet, Evergreen, Sunset and Frost, joining Night, Daybreak, Nebula,
|
||||
Retro Tube, Deep Sea and High Contrast. Design only: each is shown on the Orbit Simple home frame from build-layouts.py,
|
||||
recoloured, with MOCK DATA as before. Any layout can take any theme, since layouts only use these roles.
|
||||
|
||||
Roles, as in Themes.kt's Palette: background, deep, surface (panel), track, accent, muted, ink, text, on (switch on),
|
||||
and the picture stand-in's three shades.
|
||||
|
||||
Run: python3 design/layouts/build-themes.py
|
||||
"""
|
||||
import base64
|
||||
import importlib.util
|
||||
import io
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
spec = importlib.util.spec_from_file_location("layouts1", HERE / "build-layouts.py")
|
||||
L = importlib.util.module_from_spec(spec); spec.loader.exec_module(L)
|
||||
|
||||
THEMES = {
|
||||
"velvet": dict(NAVY="#1E0710", DEEP="#2A0B17", PANEL="#4A1428", BLUE="#6B2340", GOLD="#D9A441", MUTED="#E3C3B0",
|
||||
INK="#F4E6DC", WHITE="#FFF6EE", MINT="#E7C27A", pic=("#5A1A32", "#1A0610", "#7A2A48")),
|
||||
"evergreen": dict(NAVY="#0B1F17", DEEP="#10291F", PANEL="#1C4232", BLUE="#2C5E47", GOLD="#E8C468", MUTED="#BFD3C2",
|
||||
INK="#EFE6D4", WHITE="#F6EFE0", MINT="#9EE0B5", pic=("#2C5A44", "#0A1A12", "#3E7058")),
|
||||
"sunset": dict(NAVY="#1F0F2E", DEEP="#2A1440", PANEL="#4A2358", BLUE="#6A3466", GOLD="#FFB066", MUTED="#E5C2D4",
|
||||
INK="#FBE8DF", WHITE="#FFF4EC", MINT="#FFC98A", pic=("#6A2F5E", "#1A0B26", "#8A4468")),
|
||||
"frost": dict(NAVY="#EAF2F8", DEEP="#DCE8F2", PANEL="#FFFFFF", BLUE="#C3D6E6", GOLD="#1F5F8F", MUTED="#4F6B82",
|
||||
INK="#24425A", WHITE="#12324A", MINT="#3BA37A", pic=("#BFD6E8", "#8FB0CC", "#E9F2FA")),
|
||||
}
|
||||
ORIGINAL_PIC = ("#1D3F7A", "#0A1B3D", "#2A5296")
|
||||
|
||||
|
||||
def tinted(u, colour):
|
||||
"""A white icon or logo redrawn in [colour], for the light theme."""
|
||||
raw = base64.b64decode(u.split(",", 1)[1])
|
||||
im = Image.open(io.BytesIO(raw)).convert("RGBA")
|
||||
r, g, b = (int(colour[i:i + 2], 16) for i in (1, 3, 5))
|
||||
px = im.load()
|
||||
for y in range(im.height):
|
||||
for x in range(im.width):
|
||||
p = px[x, y]
|
||||
if p[3] and min(p[:3]) > 170: px[x, y] = (r, g, b, p[3]) # only the white parts; colours stay
|
||||
buf = io.BytesIO(); im.save(buf, "PNG"); return "data:image/png;base64," + base64.b64encode(buf.getvalue()).decode()
|
||||
|
||||
|
||||
base_init, base_save = L.Frame.__init__, L.Frame.save
|
||||
icons, logos = dict(L.ICON), dict(L.LOGO)
|
||||
for name, t in THEMES.items():
|
||||
for k in ("NAVY", "DEEP", "PANEL", "BLUE", "GOLD", "MUTED", "INK", "WHITE", "MINT"): setattr(L, k, t[k])
|
||||
L.ICON = {k: tinted(v, t["WHITE"]) for k, v in icons.items()} if name == "frost" else icons
|
||||
L.LOGO = {k: tinted(v, t["WHITE"]) for k, v in logos.items()} if name == "frost" else logos
|
||||
|
||||
def init(self, fname, title, bg=None, _t=t, _n=name):
|
||||
base_init(self, f"theme-{_n}-home", f"{title} ({_n.title()} theme)", _t["NAVY"] if bg in (None, "#071632") else bg)
|
||||
|
||||
def save(self, _t=t):
|
||||
for a, b in zip(ORIGINAL_PIC, _t["pic"]): self.p = [s.replace(a, b) for s in self.p]
|
||||
base_save(self)
|
||||
|
||||
L.Frame.__init__, L.Frame.save = init, save
|
||||
L.simple_home()
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 181 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 187 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
Reference in New Issue
Block a user