移除卡片四角装饰,主题切换改为深色/浅色分段按钮
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-12
@@ -100,12 +100,11 @@
|
||||
box-shadow:0 0 20px var(--nav-active-glow),inset 0 1px 0 rgba(255,255,255,.15);
|
||||
}
|
||||
|
||||
.theme-toggle{
|
||||
border-radius:999px;
|
||||
transition:box-shadow .2s,border-color .2s;
|
||||
.theme-switch-btn:hover{
|
||||
color:var(--text-primary);
|
||||
}
|
||||
.theme-toggle:hover{
|
||||
box-shadow:0 0 16px var(--nav-hover-glow);
|
||||
.theme-switch-btn.active{
|
||||
box-shadow:0 0 12px var(--btn-glow);
|
||||
}
|
||||
|
||||
.card{
|
||||
@@ -120,13 +119,6 @@
|
||||
.card::after{
|
||||
animation:tech-shine 5s ease-in-out infinite;
|
||||
}
|
||||
.card-corner{
|
||||
width:16px;height:16px;opacity:.55;
|
||||
transition:opacity .25s,box-shadow .25s;
|
||||
}
|
||||
.card:hover .card-corner{opacity:.9;box-shadow:0 0 8px var(--accent)}
|
||||
.card-corner.tr{top:10px;right:10px;border-top:2px solid;border-right:2px solid}
|
||||
.card-corner.bl{bottom:10px;left:10px;border-bottom:2px solid;border-left:2px solid}
|
||||
.card h2{letter-spacing:.03em}
|
||||
.card h2:before{
|
||||
box-shadow:0 0 12px var(--accent),0 0 4px var(--accent-2);
|
||||
|
||||
+19
-10
@@ -1,16 +1,24 @@
|
||||
(function () {
|
||||
var KEY = 'qihuo-theme';
|
||||
|
||||
function updateButtons(theme) {
|
||||
document.querySelectorAll('[data-theme-pick]').forEach(function (btn) {
|
||||
var pick = btn.getAttribute('data-theme-pick');
|
||||
var on = pick === theme;
|
||||
btn.classList.toggle('active', on);
|
||||
btn.setAttribute('aria-pressed', on ? 'true' : 'false');
|
||||
});
|
||||
}
|
||||
|
||||
function apply(theme) {
|
||||
if (theme !== 'light' && theme !== 'dark') {
|
||||
theme = 'dark';
|
||||
}
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
try {
|
||||
localStorage.setItem(KEY, theme);
|
||||
} catch (e) { /* ignore */ }
|
||||
var btn = document.getElementById('theme-toggle');
|
||||
if (btn) {
|
||||
btn.setAttribute('data-active', theme);
|
||||
btn.setAttribute('aria-label', theme === 'light' ? '切换到深色' : '切换到浅色');
|
||||
}
|
||||
updateButtons(theme);
|
||||
}
|
||||
|
||||
var saved = null;
|
||||
@@ -26,11 +34,12 @@
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
var btn = document.getElementById('theme-toggle');
|
||||
if (!btn) return;
|
||||
btn.addEventListener('click', function () {
|
||||
var cur = document.documentElement.getAttribute('data-theme') || 'dark';
|
||||
apply(cur === 'dark' ? 'light' : 'dark');
|
||||
var cur = document.documentElement.getAttribute('data-theme') || 'dark';
|
||||
updateButtons(cur);
|
||||
document.querySelectorAll('[data-theme-pick]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
apply(btn.getAttribute('data-theme-pick'));
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user