Update FPS chart colors dynamically when accent color changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 22:00:01 +03:00
parent bd6c072adf
commit 5f90336edd
2 changed files with 13 additions and 0 deletions

View File

@@ -814,6 +814,18 @@ document.addEventListener('languageChanged', () => {
loadDashboard();
});
// Update FPS chart colors when accent color changes
document.addEventListener('accentColorChanged', () => {
const accent = _getAccentColor();
for (const chart of Object.values(_fpsCharts)) {
if (!chart) continue;
chart.data.datasets[0].borderColor = accent;
chart.data.datasets[0].backgroundColor = accent + '1f';
chart.data.datasets[1].borderColor = accent + '80';
chart.update();
}
});
// Pause uptime timer when browser tab is hidden, resume when visible
document.addEventListener('visibilitychange', () => {
if (document.hidden) {

View File

@@ -246,6 +246,7 @@
const native = document.getElementById('cp-native-accent');
if (native) native.value = hex;
localStorage.setItem('accentColor', hex);
document.dispatchEvent(new CustomEvent('accentColorChanged', { detail: { color: hex } }));
if (!silent) showToast('Accent color updated', 'info');
}