v0.11.0: web mixes pick their own color
The export dialog gains an accent color — the hover background on links and
tracklist rows, and the player's progress fill — and the rest of the bar loses
its 2010 gold so that choice is the only color in it.
The accent travels as a `:root { --accent }` custom property declared in
index.html, which player.css reads as `var(--accent, #8c764a)`. That keeps the
stylesheet in the verbatim copyfile loop: index.html is still the only rendered
template. `normalize_accent` is the injection gate — the value lands raw inside
a <style> block and string.Template escapes nothing — and `contrast_text` flips
the hover text black or white, since the old page hard-coded white and a pale
accent made it unreadable.
The bar itself is now fixed light gray with black text. Its sprite glyphs are
pale lavender and yellow, drawn for the dark gold bar, so they're recolored
with `filter: brightness(0)` rather than by editing the GIF — which still ships
byte-identical, spinner and all.
Not persisted: the picker opens on #8c764a every time, so an export nobody
touches looks exactly like the mixes already online.
Claude-Session: https://claude.ai/code/session_01JBSM2bFC6UToiEg8BE4dqj
This commit is contained in:
+8
-1
@@ -5,7 +5,7 @@ slider's filled groove, the visualizer bars) reads QPalette.Highlight, so
|
||||
recoloring is a palette swap. UI scale adjusts the app font, scrollbar
|
||||
dimensions, and (via MainWindow.apply_ui_metrics) table row heights.
|
||||
"""
|
||||
from PyQt6.QtGui import QPalette, QColor, QFontDatabase
|
||||
from PyQt6.QtGui import QPalette, QColor, QFontDatabase, QIcon, QPixmap
|
||||
|
||||
|
||||
# The font the now-playing panel wants by default. Not bundled (it's a
|
||||
@@ -107,6 +107,13 @@ def gray_value(prefs, key: str) -> int:
|
||||
return default_gray(key) if saved is None else max(0, min(255, int(saved)))
|
||||
|
||||
|
||||
def swatch_icon(color_hex: str, size: int = 18) -> QIcon:
|
||||
"""A flat square of `color_hex` — the icon on a color-choosing control."""
|
||||
pixmap = QPixmap(size, size)
|
||||
pixmap.fill(QColor(color_hex))
|
||||
return QIcon(pixmap)
|
||||
|
||||
|
||||
def highlight_color(prefs) -> QColor:
|
||||
return QColor(HIGHLIGHT_COLORS.get(prefs.get("highlight"),
|
||||
HIGHLIGHT_COLORS["blue"]))
|
||||
|
||||
Reference in New Issue
Block a user