Files
claudeandClaude Opus 5.5 101250a3b9 Dex-only login, anonymous listening, flash-free Catppuccin welcome page
- The theme is now a stylesheet linked from index.html (ConfigMap
  funkwhale-theme), not in-app custom CSS, so it applies on first paint.
  Primary buttons and links use Dex's mauve/lavender exactly; the
  welcome page gets a Catppuccin gradient and the eom.dev logo instead
  of the sky-blue banner and whales, and its login card is a plain
  surface. tools/gen-palettes.py regenerates the palette ramps, with the
  light and dark halves fixed.
- funkwhale-oidc v0.2.0 with funkwhale_oidc_local_login: false. Dex is
  the only way in, and the break-glass admin is skipped.
- common__api_authentication_required: false (anonymous access), plus a
  long description for the welcome page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 15:44:58 -05:00

64 lines
2.4 KiB
Python
Executable File

#!/usr/bin/env python3
# SPDX-License-Identifier: MIT-0
"""Regenerates the palette block at the end of files/catppuccin.css.
Funkwhale 2.x (front/src/ui/fw.css) reads each --fw-<palette>-N ramp as
light-dark(step N, step 1000-N). Light mode uses low steps as tints and
550 as the solid fill; dark mode uses high steps as dark tints and 450 as
the fill. So the low half mixes the Mocha colour toward white (dark mode's
fill at 450 is then nearly the Mocha colour) and the high half mixes the
Latte colour toward crust (light mode's fill at 550 is nearly Latte).
python3 tools/gen-palettes.py
"""
import pathlib
CSS = pathlib.Path(__file__).resolve().parent.parent / "files" / "catppuccin.css"
MARKER = "/* Funkwhale's colour palettes"
# fw palette: (Catppuccin name, Latte, Mocha). fw-blue is Funkwhale's
# primary colour and fw-orange its accent.
PALETTES = {
"blue": ("mauve", "#8839ef", "#cba6f7"),
"orange": ("peach", "#fe640b", "#fab387"),
"red": ("red", "#d20f39", "#f38ba8"),
"pink": ("pink", "#ea76cb", "#f5c2e7"),
"pastel-blue": ("blue", "#1e66f5", "#89b4fa"),
"pastel-green": ("green", "#40a02b", "#a6e3a1"),
"pastel-ochre": ("peach", "#fe640b", "#fab387"),
"pastel-purple": ("lavender", "#7287fd", "#b4befe"),
"pastel-red": ("maroon", "#e64553", "#eba0ac"),
"pastel-yellow": ("yellow", "#df8e1d", "#f9e2af"),
}
def ramp(latte, mocha):
for n in range(50, 1000, 50):
if n < 500:
p = round((n / 500) ** 1.5 * 100)
yield n, f"color-mix(in oklch, {mocha} {p}%, #ffffff)"
elif n == 500:
yield n, f"color-mix(in oklch, {latte}, {mocha})"
else:
p = round(((1000 - n) / 500) ** 1.5 * 100)
yield n, f"color-mix(in oklch, {latte} {p}%, #11111b)"
lines = [
MARKER + " (alerts, tags, buttons), rebuilt from Catppuccin.",
" * Generated by tools/gen-palettes.py; edit that, not this block. */",
":root {",
]
for fw, (name, latte, mocha) in PALETTES.items():
lines.append(f" /* {fw}: {name} */")
lines += [f" --fw-{fw}-{n}: {v};" for n, v in ramp(latte, mocha)]
lines.append(" /* gray: Latte surfaces, then Mocha surfaces. */")
for n in range(50, 1000, 50):
lines.append(f" --fw-gray-{n}: var(--ctp-{'l' if n <= 500 else 'd'}-{n if n <= 500 else 1000 - n});")
lines.append("}")
text = CSS.read_text()
head = text[: text.index(MARKER)] if MARKER in text else text + "\n"
CSS.write_text(head + "\n".join(lines) + "\n")
print(f"wrote {CSS}")