Files
2026-07-08 17:41:38 +08:00

31 lines
2.0 KiB
HTML

<header class="site-nav">
<div class="nav-inner container">
<a href="/" class="nav-brand">
<img src="{{ .Site.Params.logo }}" alt="{{ .Site.Title }}" class="nav-logo" width="32" height="32">
<span>{{ .Site.Title }}</span>
</a>
<nav class="nav-links">
{{ range .Site.Params.navLinks }}
<a href="{{ .url }}" {{ if .external }}target="_blank" rel="noopener"{{ end }}>{{ .name }}</a>
{{ end }}
<button class="theme-toggle" id="theme-toggle" title="切换主题">
<svg class="theme-icon-warm" viewBox="0 0 24 24" width="18" height="18"><circle cx="12" cy="12" r="5" fill="currentColor" stroke="none"/><line x1="12" y1="1" x2="12" y2="3" stroke="currentColor" stroke-width="2"/><line x1="12" y1="21" x2="12" y2="23" stroke="currentColor" stroke-width="2"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64" stroke="currentColor" stroke-width="2"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78" stroke="currentColor" stroke-width="2"/><line x1="1" y1="12" x2="3" y2="12" stroke="currentColor" stroke-width="2"/><line x1="21" y1="12" x2="23" y2="12" stroke="currentColor" stroke-width="2"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36" stroke="currentColor" stroke-width="2"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22" stroke="currentColor" stroke-width="2"/></svg>
<svg class="theme-icon-cyan" viewBox="0 0 24 24" width="18" height="18"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z" fill="none" stroke="currentColor" stroke-width="2"/></svg>
</button>
</nav>
</div>
</header>
<script>
(function(){
var t = localStorage.getItem('snoware-theme') || 'warm';
document.documentElement.setAttribute('data-theme', t);
var btn = document.getElementById('theme-toggle');
if(btn) btn.addEventListener('click', function(){
var cur = document.documentElement.getAttribute('data-theme');
var next = cur === 'warm' ? 'cyan' : 'warm';
document.documentElement.setAttribute('data-theme', next);
localStorage.setItem('snoware-theme', next);
});
})();
</script>