Skip to content

feat: añade Modo Oscuro completo con persistencia en localStorage#43

Open
Moha0x1 wants to merge 2 commits into
midudev:mainfrom
Moha0x1:feature/dark-mode-clean
Open

feat: añade Modo Oscuro completo con persistencia en localStorage#43
Moha0x1 wants to merge 2 commits into
midudev:mainfrom
Moha0x1:feature/dark-mode-clean

Conversation

@Moha0x1
Copy link
Copy Markdown
Contributor

@Moha0x1 Moha0x1 commented Apr 23, 2026

No description provided.

@midudev
Copy link
Copy Markdown
Owner

midudev commented May 26, 2026

@copilot resolve the merge conflicts in this pull request

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Este PR introduce un modo oscuro basado en tokens CSS y añade persistencia del tema mediante localStorage, aplicando el tema temprano en el <head> para evitar parpadeos y habilitando un toggle en la home.

Changes:

  • Añade tokens RGB y overrides para :root.dark, y migra múltiples colores “hardcodeados” a variables.
  • Incorpora un botón de cambio de tema en la cabecera de index.astro y guarda la preferencia en localStorage.
  • Inicializa el tema en Layout.astro en función de localStorage o prefers-color-scheme.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
web/src/styles/global.css Define tokens para light/dark y adapta estilos a variables para soportar modo oscuro.
web/src/pages/index.astro Añade UI de toggle de tema y lógica de persistencia al click.
web/src/layouts/Layout.astro Aplica el tema inicial en el <head> según preferencia guardada o media query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +91
<script is:inline>
const theme = (() => {
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
return localStorage.getItem('theme');
}
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
}
return 'light';
})();
if (theme === 'dark') {
document.documentElement.classList.add('dark');
}
</script>
Comment thread web/src/pages/index.astro
</svg>
<span>GitHub</span>
</a>
<button id="theme-toggle" class="theme-toggle" aria-label="Cambiar tema">
Comment thread web/src/pages/index.astro
Comment on lines +414 to +420
const themeToggle = document.getElementById('theme-toggle');
themeToggle?.addEventListener('click', () => {
const element = document.documentElement;
element.classList.toggle('dark');
const isDark = element.classList.contains('dark');
localStorage.setItem('theme', isDark ? 'dark' : 'light');
});
Comment thread web/src/styles/global.css
Comment on lines +33 to +39
--glass-bg: 30, 30, 28;
--shadow-rgb: 0, 0, 0;
--text-rgb: 230, 225, 218;
--border-rgb: 44, 44, 40;
--accent-rgb: 224, 122, 95;
--black-rgb: 255, 255, 255;
--bg-rgb: 17, 17, 16;
Comment thread web/src/styles/global.css
Comment on lines +48 to 58
.theme-toggle {
background: none;
border: none;
padding: 0;
margin: 0 0.75rem;
display: flex;
align-items: center;
color: var(--ui-icon-color);
cursor: pointer;
transition: color 150ms ease;
}
Comment thread web/src/styles/global.css
Comment on lines 443 to +448
.search-control:focus-within {
border-color: rgba(197, 90, 61, 0.42);
border-color: rgba(var(--accent-rgb), 0.42);
background: white;
box-shadow:
0 14px 36px rgba(41, 31, 23, 0.07),
0 0 0 4px rgba(197, 90, 61, 0.09);
0 14px 36px rgba(var(--shadow-rgb), 0.07),
0 0 0 4px rgba(var(--accent-rgb), 0.09);
Comment thread web/src/styles/global.css
Comment on lines 782 to 787
.book:hover,
.book:focus-within {
background: white;
border-color: var(--border);
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
box-shadow: 0 4px 20px rgba(var(--black-rgb), 0.06);
transform: translateY(-2px);
Comment thread web/src/styles/global.css
Comment on lines 1751 to 1755
background:
linear-gradient(90deg, rgba(26, 26, 26, 0.035) 1px, transparent 1px),
linear-gradient(180deg, rgba(26, 26, 26, 0.035) 1px, transparent 1px),
linear-gradient(90deg, rgba(var(--text-rgb), 0.035) 1px, transparent 1px),
linear-gradient(180deg, rgba(var(--text-rgb), 0.035) 1px, transparent 1px),
#f3eee6;
background-size: 22px 22px;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants