-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.js
More file actions
23 lines (20 loc) · 957 Bytes
/
theme.js
File metadata and controls
23 lines (20 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function applyGlobalTheme() {
const savedMode = localStorage.getItem('bt_mode') || 'dark';
document.documentElement.setAttribute('data-theme', savedMode);
const savedSkin = localStorage.getItem('bt_current_skin') || 'red';
const skinColors = {
'red': '#ff0000', 'blue': '#0088ff', 'yellow': '#ffcc00',
'green': '#00ff00', 'cyan': '#00ffff', 'pink': '#ff00ff',
'purple': '#9900ff', 'orange': '#ff6600', 'gold': '#ffd700'
};
if(savedSkin === 'rainbow') {
document.body.classList.add('rainbow-active');
document.documentElement.style.animation = "rainbow-glow 5s infinite linear";
} else {
document.body.classList.remove('rainbow-active');
document.documentElement.style.animation = "none";
document.documentElement.style.setProperty('--accent', skinColors[savedSkin] || '#ff0000');
}
}
applyGlobalTheme();
window.addEventListener('focus', applyGlobalTheme);