Update FPS chart colors dynamically when accent color changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user