diff --git a/src/App.vue b/src/App.vue index 9ca43214..e9079c5e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -40,11 +40,11 @@ import { TGAppDataList, TGGetDataList } from "./data"; const appStore = useAppStore(); const isMain = ref(true as boolean); +const theme = ref(appStore.theme as string); onMounted(async () => { // 获取当前主题 - const theme = appStore.theme; - document.documentElement.className = theme; + document.documentElement.className = theme.value; // 获取当前窗口 const win = window.getCurrent(); isMain.value = win.label === "tauri-genshin"; diff --git a/src/assets/css/post-parser.css b/src/assets/css/post-parser.css index 6cade073..acaa33df 100644 --- a/src/assets/css/post-parser.css +++ b/src/assets/css/post-parser.css @@ -1,12 +1,13 @@ /* * @description 米游社解析 css - * @since Alpha v0.1.1 + * @since Alpha v0.1.3 */ -/* todo scoped 不生效 */ + .mys-post-body { margin: 20px auto; width: 800px; font-family: "Genshin-Light", serif; + color: var(--post-default-text); } :deep(.mys-post-div) { @@ -69,7 +70,7 @@ padding: 10px; border-radius: 10px; display: flex; - background: #faf7e8; + background: var(--content-bg-2); } :deep(.mys-post-unknown) { diff --git a/src/assets/index.css b/src/assets/index.css index 15a3a7f3..2b625a05 100644 --- a/src/assets/index.css +++ b/src/assets/index.css @@ -26,16 +26,6 @@ background: #555; } -/* - * @description 米游社解析 json - * @since Alpha v0.1.1 - */ -.dev-json { - padding: 20px; - border-radius: 20px; - font-family: Consolas, serif; -} - /* card action 内的按钮 */ .card-btn { background: #4a5366; diff --git a/src/assets/themes/dark.css b/src/assets/themes/dark.css new file mode 100644 index 00000000..4799e322 --- /dev/null +++ b/src/assets/themes/dark.css @@ -0,0 +1,30 @@ +/** + * @file assets themes light.css + * @description 主题样式文件 + * @author BTMuli + * @since Alpha v0.1.3 + */ + +/* 主题色 */ +html.dark { + --sidebar-bg: #1e1e1e; + --sidebar-icon: #e1e1e1; + --page-bg:#2a2a2a; + --back-top-shadow: #000000; + --theme-switch-icon: #e1e1e1; + --post-default-text: #faf7e8; + + --content-bg-1: #1e1e1e; + --content-bg-2: #393b40; + --content-bg-3: #2a2a2a; + --content-text-1: #1e1e1e; + --content-text-2: #faf7e8; + --content-text-3: #e1e1e1; + + --btn-bg-1: #3b3d3b; + --btn-bg-2: #000000; + --btn-bg-3: #1e1e1e; + --btn-text-1: #393b40; + + --card-text-1: #393b40; +} \ No newline at end of file diff --git a/src/assets/themes/default.css b/src/assets/themes/default.css new file mode 100644 index 00000000..9d409562 --- /dev/null +++ b/src/assets/themes/default.css @@ -0,0 +1,30 @@ +/** + * @file assets themes dark.css + * @description 主题样式文件 + * @author BTMuli + * @since Alpha v0.1.3 + */ + +/* 主题色 */ +html.default { + --sidebar-bg: #485466; + --sidebar-icon: #ece5d8; + --page-bg:#ece5d8; + --back-top-shadow: #546d8b; + --theme-switch-icon: #393b40; + --post-default-text: #1e1e1e; + + --content-bg-1: #546d8b; + --content-bg-2: #faf7e8; + --content-bg-3: #5b738f; + --content-text-1: #fec90b; + --content-text-2: #393b40; + --content-text-3: #546d8b; + + --btn-bg-1: #fec90b; + --btn-bg-2: #4a5366; + --btn-bg-3: #546d8b; + --btn-text-1: #faf7e8; + + --card-text-1: #485466; +} \ No newline at end of file diff --git a/src/components/t-backTop.vue b/src/components/t-backTop.vue index ef5ae5c7..cf2159ac 100644 --- a/src/components/t-backTop.vue +++ b/src/components/t-backTop.vue @@ -64,7 +64,7 @@ onMounted(() => { cursor: pointer; transform: scale(0.9); transition: all 0.3s ease-in-out; - box-shadow: 0 0 10px 5px #546d8b; + box-shadow: 0 0 10px 5px var(--back-top-shadow); } .back-top img { diff --git a/src/components/t-calendar.vue b/src/components/t-calendar.vue index d7c3f802..6c42a6ee 100644 --- a/src/components/t-calendar.vue +++ b/src/components/t-calendar.vue @@ -11,8 +11,9 @@ :key="text.week" class="calendar-btn" :style="{ - border: text.week === weekNow ? '2px solid #fec90b' : '0', - background: text.week === btnNow ? '#fec90b' : '#4A5366', + border: text.week === weekNow ? '2px solid var(--btn-bg-1)' : '0', + background: text.week === btnNow ? 'var(--btn-bg-1)' : 'var(--btn-bg-2)', + color: '#faf7e8' }" @click="getContents(text.week)" > @@ -239,14 +240,14 @@ function getContents (day: number) { .calendar-card { margin-top: 10px; font-family: Genshin-Light, serif; - background: #546d8b; + background: var(--content-bg-1); border-radius: 10px; } .calendar-btn { margin-left: 10px; font-family: Genshin-Light, serif; - color: #faf7e8; + color: var(--btn-text-1); border-radius: 10px; } @@ -262,8 +263,8 @@ function getContents (day: number) { .calendar-single { margin-bottom: 10px; - background: #faf7e8; - color: #546d8b; + background: var(--content-bg-2); + color: var(--content-bg-1); border-radius: 10px; } @@ -276,8 +277,8 @@ function getContents (day: number) { } .calendar-content { - background: #546D8B; - color:#faf7e8; + background: var(--content-bg-1); + color:var(--content-bg-2); margin: 5px; border-radius: 10px; padding: 10px; @@ -414,7 +415,7 @@ function getContents (day: number) { display: flex; justify-content: center; align-items: center; - background: rgba(20, 20, 20, 0.5); + background: rgb(20 20 20 / 50%); border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; color: #fff; diff --git a/src/components/t-confirm.vue b/src/components/t-confirm.vue index 4607fe00..4dab8deb 100644 --- a/src/components/t-confirm.vue +++ b/src/components/t-confirm.vue @@ -73,7 +73,7 @@ const onConfirm = () => { height: 20vh; top: 40vh; left: 30vw; - background: #fff; + background: var(--content-bg-2); border-radius: 10px; padding: 10px; display: flex; @@ -92,7 +92,7 @@ const onConfirm = () => { text-align: center; height: 20%; width: 100%; - color: #393b40; + color: var(--content-text-2); margin: 20px; font-size: 30px; } @@ -109,8 +109,8 @@ const onConfirm = () => { width: 30%; min-width: 150px; min-height: 30px; - background: #4a5366; - color: #faf7e8; + background: var(--btn-bg-2); + color: var(--btn-text-1); border-radius: 50px; display: flex; align-items: center; diff --git a/src/components/t-pool.vue b/src/components/t-pool.vue index f265ace2..3f9a3a4e 100644 --- a/src/components/t-pool.vue +++ b/src/components/t-pool.vue @@ -9,9 +9,9 @@ - +