Rework website palette, copy, and theme support
- Align color palette with TUI Everforest theme (feynman.json) - Rewrite homepage copy with sharper section headings and descriptions - Fix dark/light theme toggle persistence across page navigation - Add Shiki Everforest syntax themes for code blocks - Fix copy-code button z-index and pointer events - Add styled scrollbars and text selection colors - Tighten hero image padding, remove unused public/hero.png - Remove Modal/RunPod from site (Docker only for now) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,21 +13,41 @@
|
||||
var stored = localStorage.getItem('theme');
|
||||
var prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
var dark = stored === 'dark' || (!stored && prefersDark);
|
||||
if (dark) document.documentElement.classList.add('dark');
|
||||
function update() {
|
||||
var isDark = document.documentElement.classList.contains('dark');
|
||||
document.getElementById('sun-icon').style.display = isDark ? 'block' : 'none';
|
||||
document.getElementById('moon-icon').style.display = isDark ? 'none' : 'block';
|
||||
if (dark) {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
update();
|
||||
|
||||
function updateIcons() {
|
||||
var isDark = document.documentElement.classList.contains('dark');
|
||||
var sun = document.getElementById('sun-icon');
|
||||
var moon = document.getElementById('moon-icon');
|
||||
if (sun) sun.style.display = isDark ? 'block' : 'none';
|
||||
if (moon) moon.style.display = isDark ? 'none' : 'block';
|
||||
}
|
||||
|
||||
function bindToggle() {
|
||||
var btn = document.getElementById('theme-toggle');
|
||||
if (btn && !btn._bound) {
|
||||
btn._bound = true;
|
||||
btn.addEventListener('click', function() {
|
||||
document.documentElement.classList.toggle('dark');
|
||||
var isDark = document.documentElement.classList.contains('dark');
|
||||
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
||||
updateIcons();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
updateIcons();
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
update();
|
||||
document.getElementById('theme-toggle').addEventListener('click', function() {
|
||||
document.documentElement.classList.toggle('dark');
|
||||
var isDark = document.documentElement.classList.contains('dark');
|
||||
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
||||
update();
|
||||
});
|
||||
updateIcons();
|
||||
bindToggle();
|
||||
});
|
||||
document.addEventListener('astro:after-swap', function() {
|
||||
updateIcons();
|
||||
bindToggle();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user