style(config): 加入 Mica 云母效果

1. style(config): 默认亮暗色改为 LIGHT_MODE
2. 更新知更鸟 Credit: Pixiv @KiraraShss
3. style(config): 加入 theme-color 顶部横幅
This commit is contained in:
Ad-closeNN
2025-08-14 14:26:29 +08:00
parent 895eb0dae7
commit 1492795896
5 changed files with 119 additions and 42 deletions
+7 -17
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { AUTO_MODE, DARK_MODE, LIGHT_MODE } from "@constants/constants.ts";
import { DARK_MODE, LIGHT_MODE } from "@constants/constants.ts";
import I18nKey from "@i18n/i18nKey";
import { i18n } from "@i18n/translation";
import Icon from "@iconify/svelte";
@@ -16,19 +16,9 @@ let mode: LIGHT_DARK_MODE = LIGHT_MODE;
onMount(() => {
mode = getStoredTheme();
const darkModePreference = window.matchMedia("(prefers-color-scheme: dark)");
const changeThemeWhenSchemeChanged: Parameters<
typeof darkModePreference.addEventListener<"change">
>[1] = (_e) => {
applyThemeToDocument(mode);
};
darkModePreference.addEventListener("change", changeThemeWhenSchemeChanged);
return () => {
darkModePreference.removeEventListener(
"change",
changeThemeWhenSchemeChanged,
);
};
// 移除了系统主题监听功能
// 只在初始化时应用存储的主题
applyThemeToDocument(mode);
});
function switchScheme(newMode: LIGHT_DARK_MODE) {
@@ -67,8 +57,8 @@ function hidePanel() {
<Icon icon="material-symbols:dark-mode-outline-rounded" class="text-[1.25rem]"></Icon>
</div>
</button>
<div id="light-dark-panel" class="hidden lg:block absolute transition float-panel-closed top-11 -right-2 pt-5" >
<div id="light-dark-panel" class="hidden lg:block absolute transition float-panel-closed top-11 -right-2 pt-5">
<div class="card-base float-panel p-2">
<button class="flex transition whitespace-nowrap items-center !justify-start w-full btn-plain scale-animation rounded-lg h-9 px-3 font-medium active:scale-95 mb-0.5"
class:current-theme-btn={mode === LIGHT_MODE}
@@ -86,4 +76,4 @@ function hidePanel() {
</button>
</div>
</div>
</div>
</div>