diff --git a/src/components/ThemeToggle.astro b/src/components/ThemeToggle.astro index 3e2f058..7c729b5 100644 --- a/src/components/ThemeToggle.astro +++ b/src/components/ThemeToggle.astro @@ -1,4 +1,11 @@ +--- +import { themeConfig } from '@/config' + +const { light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color +--- + - diff --git a/src/config.ts b/src/config.ts index d4a2e06..235de33 100644 --- a/src/config.ts +++ b/src/config.ts @@ -14,7 +14,7 @@ export const themeConfig: ThemeConfig = { // COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START color: { - mode: 'light', // light or dark. Matches system theme by default, falls back to configured theme mode if not available. + mode: 'light', // light, dark light: { primary: '#17191A', // accent color for title secondary: '#505050', // secondary color for text diff --git a/src/content/posts/故乡.md b/src/content/posts/故乡.md index 92ff157..b11b257 100644 --- a/src/content/posts/故乡.md +++ b/src/content/posts/故乡.md @@ -4,7 +4,7 @@ published: 2024-01-10 tags: ["鲁迅"] --- -![](https://image.radishzz.cc/image/gallery/03.webp) + 我冒了嚴寒,回到相隔二千餘里,別了二十餘年的故鄉去。 @@ -16,9 +16,9 @@ tags: ["鲁迅"] 我這次是專為了別他而來的。我們多年聚族而居的老屋,已經公同賣給別姓了,交屋的期限,只在本年,所以必須趕在正月初一以前,永別了熟識的老屋,而且遠離了熟識的故鄉,搬家到我在謀食的異地去。 -第二日清早晨我到了我家的門口了。瓦楞上許多枯草的斷莖當風抖著,正在說明這老屋難免易主的原因。幾房的本家大約已經搬走了,所以很寂靜。我到了自家的房外,我的母親早已迎著出來了,接著便飛出了八歲的侄兒宏兒。 + -我的母親很高興,但也藏著許多淒涼的神情,教我坐下,歇息,喝茶,且不談搬家的事。宏兒沒有見過我,遠遠的對面站著只是看。 + diff --git a/src/layouts/Head.astro b/src/layouts/Head.astro index 32651cd..79c6648 100644 --- a/src/layouts/Head.astro +++ b/src/layouts/Head.astro @@ -76,64 +76,54 @@ const { commentURL = '', imageHostURL = '', customGoogleAnalyticsURL = '', custo diff --git a/src/styles/global.css b/src/styles/global.css index 960692f..9e3cd9c 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -20,7 +20,18 @@ article img { --at-apply: 'cursor-zoom-in force-gpu'; } -/* Horizontal reveal animation on theme toggle */ +/* Horizontal reveal animation during theme switching */ +::view-transition-new(theme-transition) { + animation: reveal 1s cubic-bezier(0.4, 0, 0.2, 1); + clip-path: inset(0 0 0 0); + z-index: 99; +} + +::view-transition-old(theme-transition) { + animation: none; + z-index: -1; +} + @keyframes reveal { from { clip-path: inset(var(--from)); @@ -35,21 +46,12 @@ html:not(.dark) { --from: 100% 0 0 0; } -::view-transition-new(theme-transition) { - animation: reveal 1s cubic-bezier(0.4, 0, 0.2, 1); - clip-path: inset(0 0 0 0); - z-index: 99; -} - -::view-transition-old(theme-transition) { - animation: none; - z-index: 98; -} - +/* Disable animations for other elements during theme switching */ html[data-theme-transition] [data-disable-transition-on-theme] { view-transition-name: none !important; } +/* Fallback animation when view-transition-name is not supported */ @supports not (view-transition-name: none) { html:not([data-restore-theme]) { --at-apply: 'transition-colors duration-300 ease-out';