agrega toggle de modo claro/oscuro con persistencia en localStorage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 18:20:08 -04:00
parent 36a40938c7
commit ca021cc3f7
5 changed files with 67 additions and 19 deletions
+2 -2
View File
@@ -197,7 +197,7 @@ function clearEmoji(id) {
.emoji-picker { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.emoji-opt {
background: var(--surface);
border: 1px solid #333;
border: 1px solid var(--border2);
border-radius: 6px;
font-size: 1.15rem;
width: 34px; height: 34px;
@@ -205,7 +205,7 @@ function clearEmoji(id) {
display: flex; align-items: center; justify-content: center;
transition: background .12s, transform .1s;
}
.emoji-opt:hover { background: #333; transform: scale(1.15); }
.emoji-opt:hover { background: var(--surface3); transform: scale(1.15); }
.emoji-thumb { font-size: 1.6rem; }
+1 -1
View File
@@ -162,7 +162,7 @@
.result-info { flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.result-name { font-size: .9rem; font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.winner-badge { background: rgba(255,215,0,.15); color: gold; font-size: .75rem; padding: 1px 6px; border-radius: 10px; border: 1px solid rgba(255,215,0,.3); }
.result-bar-wrap { height: 6px; background: #333; border-radius: 3px; overflow: hidden; }
.result-bar-wrap { height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.result-bar { height: 100%; background: var(--green); border-radius: 3px; transition: width .4s; }
.result-count { display: flex; flex-direction: column; align-items: flex-end; min-width: 50px; }
.result-count strong { font-size: 1.1rem; }
+17 -1
View File
@@ -1,9 +1,10 @@
<!DOCTYPE html>
<html lang="es">
<html lang="es" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Spotify Cantina{% endblock %}</title>
<script>(function(){var t=localStorage.getItem('theme')||'dark';document.documentElement.setAttribute('data-theme',t);})()</script>
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
@@ -13,6 +14,7 @@
<a href="/">Reproductor</a>
<a href="/stats/">Estadísticas</a>
<a id="admin-nav-btn" href="/admin/login" class="btn-sm">Admin</a>
<button id="theme-toggle" class="theme-toggle" onclick="toggleTheme()" title="Cambiar tema">☀️</button>
</div>
</nav>
<script>
@@ -23,6 +25,20 @@
btn.href = '/admin/playlists';
}
}).catch(() => {});
function toggleTheme() {
const current = document.documentElement.getAttribute('data-theme') || 'dark';
const next = current === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', next);
localStorage.setItem('theme', next);
document.getElementById('theme-toggle').textContent = next === 'dark' ? '☀️' : '🌙';
}
(function syncToggleIcon() {
const t = document.documentElement.getAttribute('data-theme') || 'dark';
const btn = document.getElementById('theme-toggle');
if (btn) btn.textContent = t === 'dark' ? '☀️' : '🌙';
})();
</script>
<main>
{% block content %}{% endblock %}
+7 -7
View File
@@ -456,7 +456,7 @@ setInterval(fetchVotingStatus, 5000);
.vote-bar-wrap {
width: 100%;
height: 4px;
background: #333;
background: var(--surface3);
border-radius: 2px;
overflow: hidden;
margin-top: 4px;
@@ -498,7 +498,7 @@ setInterval(fetchVotingStatus, 5000);
}
.vote-btn:hover:not(:disabled) { background: var(--green-dark); }
.vote-btn:disabled {
background: #333;
background: var(--surface3);
color: var(--text-muted);
cursor: not-allowed;
opacity: .8;
@@ -516,8 +516,8 @@ setInterval(fetchVotingStatus, 5000);
padding: 1rem;
}
.modal-box {
background: #1a1a1a;
border: 1px solid #333;
background: var(--modal-bg);
border: 1px solid var(--border2);
border-radius: 12px;
width: 100%;
max-width: 520px;
@@ -531,7 +531,7 @@ setInterval(fetchVotingStatus, 5000);
align-items: center;
justify-content: space-between;
padding: 1rem 1.2rem;
border-bottom: 1px solid #2a2a2a;
border-bottom: 1px solid var(--surface2);
gap: .8rem;
}
.modal-title-wrap {
@@ -574,7 +574,7 @@ setInterval(fetchVotingStatus, 5000);
border-radius: 4px;
flex-shrink: 0;
}
.modal-close:hover { color: #fff; background: #2a2a2a; }
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-track-list {
overflow-y: auto;
padding: .4rem 0;
@@ -587,7 +587,7 @@ setInterval(fetchVotingStatus, 5000);
cursor: pointer;
transition: background .12s;
}
.modal-track-row:hover { background: #2a2a2a; }
.modal-track-row:hover { background: var(--surface2); }
.modal-track-num {
font-size: .8rem;
color: var(--text-muted);