fix(player): wire accent picker to editorial copper palette + visual polish
Lint & Test / test (push) Successful in 9s
Lint & Test / test (push) Successful in 9s
The accent picker only mutated --accent / --accent-hover, but the redesign reads everything off --copper, --copper-hi, --copper-lo, --copper-glow. --accent was a one-way alias of --copper, so picking a color did nothing. Frontend (player.js): - applyAccentColor now drives --copper, --copper-hi, --copper-lo, and a new --copper-rgb triplet (used by every soft tint / glow on both themes) - darkenColor / hexToRgbTriple helpers added beside lightenColor CSS (styles.css): - introduce --copper-rgb tokens for both themes; --copper-glow now derives from rgba(var(--copper-rgb), 0.35) so it follows the picker - replace 21 hardcoded rgba(224,128,56,...) / rgba(31,78,61,...) literals across hover bgs, focus halos, glows, vinyl-label gradients with rgba(var(--copper-rgb), ...) - replace the light-theme vinyl-label gradient hexes with var(--copper) / var(--copper-lo) Other player polish in this changeset: - track-masthead: padding-right clamp(12px, 1.5vw, 24px) so VU meter, spectrum tail, end timecode and controls sit inset from the panel edge (zeroed on the single-column mobile breakpoint to keep symmetry) - VU meter 140→120 px, volume slider 80→64 px to free up row width so the cluster stays inline with prev/play/next instead of wrapping - light-theme VU meter override: cream gauge face, dark-ink scale ticks, hunter-emerald needle (replaces the hardcoded black gauge) - fullscreen meta-cell labels: var(--ink-faint) → var(--copper) so STATE and SOURCE read as part of the same editorial system as the kicker
This commit is contained in:
@@ -145,6 +145,22 @@ export function lightenColor(hex, percent) {
|
||||
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
||||
}
|
||||
|
||||
function darkenColor(hex, percent) {
|
||||
const num = parseInt(hex.replace('#', ''), 16);
|
||||
const r = Math.max(0, (num >> 16) - Math.round(255 * percent / 100));
|
||||
const g = Math.max(0, ((num >> 8) & 0xff) - Math.round(255 * percent / 100));
|
||||
const b = Math.max(0, (num & 0xff) - Math.round(255 * percent / 100));
|
||||
return `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
||||
}
|
||||
|
||||
function hexToRgbTriple(hex) {
|
||||
const num = parseInt(hex.replace('#', ''), 16);
|
||||
const r = (num >> 16) & 0xff;
|
||||
const g = (num >> 8) & 0xff;
|
||||
const b = num & 0xff;
|
||||
return `${r}, ${g}, ${b}`;
|
||||
}
|
||||
|
||||
export function initAccentColor() {
|
||||
const saved = localStorage.getItem('accentColor');
|
||||
if (saved) {
|
||||
@@ -159,8 +175,18 @@ export function initAccentColor() {
|
||||
}
|
||||
|
||||
export function applyAccentColor(color, hover) {
|
||||
document.documentElement.style.setProperty('--accent', color);
|
||||
document.documentElement.style.setProperty('--accent-hover', hover);
|
||||
const root = document.documentElement.style;
|
||||
root.setProperty('--accent', color);
|
||||
root.setProperty('--accent-hover', hover);
|
||||
// Editorial palette tokens — the redesign reads these directly,
|
||||
// so the picker must drive them too (the --accent alias alone has
|
||||
// no effect once components moved off it).
|
||||
root.setProperty('--copper', color);
|
||||
root.setProperty('--copper-hi', hover);
|
||||
root.setProperty('--copper-lo', darkenColor(color, 12));
|
||||
root.setProperty('--copper-rgb', hexToRgbTriple(color));
|
||||
// --copper-glow inherits the rgba(var(--copper-rgb), 0.35) formula
|
||||
// declared in styles.css, so it picks up the new RGB automatically.
|
||||
localStorage.setItem('accentColor', color);
|
||||
const dot = document.getElementById('accentDot');
|
||||
if (dot) dot.style.background = color;
|
||||
|
||||
Reference in New Issue
Block a user