From 7201eafc6501650c1d8ebc970576191ea8b6753d Mon Sep 17 00:00:00 2001 From: lelo Date: Sat, 19 Apr 2025 11:03:21 +0000 Subject: [PATCH] update custom colors --- static/app.js | 20 ++++++++++++-------- static/audioplayer.js | 9 ++++++--- templates/app.html | 8 ++++---- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/static/app.js b/static/app.js index 82a4847..c73bfcd 100644 --- a/static/app.js +++ b/static/app.js @@ -472,15 +472,19 @@ document.getElementById('globalAudio').addEventListener('ended', () => { function syncThemeColor() { - // read the CSS variable from :root (or any selector) const cssVar = getComputedStyle(document.documentElement) - .getPropertyValue('--dark-background').trim(); - if (cssVar) { - document - .querySelector('meta[name="theme-color"]') - .setAttribute('content', cssVar); - } + .getPropertyValue('--dark-background') + .trim(); + if (!cssVar) return; + + // sync the theme‑color meta tag + document.querySelector('meta[name="theme-color"]') + .setAttribute('content', cssVar); + + // apply fill to every inside elements with .icon-color + document + .querySelectorAll('.icon-color svg') + .forEach(svg => svg.setAttribute('fill', cssVar)); } -// sync once on load document.addEventListener('DOMContentLoaded', syncThemeColor); \ No newline at end of file diff --git a/static/audioplayer.js b/static/audioplayer.js index e8b541c..5e2220e 100644 --- a/static/audioplayer.js +++ b/static/audioplayer.js @@ -1,19 +1,22 @@ +// read the CSS variable from :root (or any selector) +const cssVar = getComputedStyle(document.documentElement).getPropertyValue('--dark-background').trim(); + const playerButton = document.querySelector('.player-button'), audio = document.querySelector('audio'), timeline = document.querySelector('.timeline'), timeInfo = document.getElementById('timeInfo'), playIcon = ` - + `, pauseIcon = ` - + `, soundIcon = ` - + ` diff --git a/templates/app.html b/templates/app.html index dec95fe..6084fd9 100644 --- a/templates/app.html +++ b/templates/app.html @@ -63,8 +63,8 @@ Your browser does not support the audio element.
-
-