diff --git a/src/components/ThemeSelect/index.ts b/src/components/ThemeSelect/index.ts new file mode 100644 index 00000000..2e11f666 --- /dev/null +++ b/src/components/ThemeSelect/index.ts @@ -0,0 +1,3 @@ +import ThemeSelect from './index.vue'; + +export { ThemeSelect }; diff --git a/src/components/ThemeSelect/index.vue b/src/components/ThemeSelect/index.vue new file mode 100644 index 00000000..43f49ae7 --- /dev/null +++ b/src/components/ThemeSelect/index.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/enums/styleEnum.ts b/src/enums/styleEnum.ts new file mode 100644 index 00000000..eaa4771e --- /dev/null +++ b/src/enums/styleEnum.ts @@ -0,0 +1,4 @@ +export enum ThemeEnum { + dark = 'dark', + light = 'light' +} \ No newline at end of file diff --git a/src/layout/components/Main/index.vue b/src/layout/components/Main/index.vue index 30ece487..c2b57373 100644 --- a/src/layout/components/Main/index.vue +++ b/src/layout/components/Main/index.vue @@ -1,5 +1,5 @@ diff --git a/src/styles/common/_dark.scss b/src/styles/common/_dark.scss new file mode 100644 index 00000000..546431d6 --- /dev/null +++ b/src/styles/common/_dark.scss @@ -0,0 +1,10 @@ +@import './var.scss'; + +$dark: ( + //背景 + background-color: $--color-dark-bg-1, + //渐变背景 + background-image: linear-gradient(120deg, $--color-dark-bg-1 0%, $--color-dark-bg-2 100%), + //毛玻璃 + filter-color: $--filter-color-login-dark +); diff --git a/src/styles/common/_light.scss b/src/styles/common/_light.scss new file mode 100644 index 00000000..0c51772a --- /dev/null +++ b/src/styles/common/_light.scss @@ -0,0 +1,10 @@ +@import './var.scss'; + +$light: ( + //背景 + background_color: $--color-light-fill-3, + //渐变背景 + background-image: linear-gradient(120deg, $--color-text-1 0%, $--color-text-1 100%), + //毛玻璃 + filter-color: $--filter-color-login-light +); diff --git a/src/styles/common/mixins/mixins.scss b/src/styles/common/mixins/mixins.scss index 46aced6d..fdaba133 100644 --- a/src/styles/common/mixins/mixins.scss +++ b/src/styles/common/mixins/mixins.scss @@ -1,6 +1,6 @@ @import './config.scss'; @import './function.scss'; -@import './theme.scss'; +@import '../theme.scss'; @mixin go($block) { $B: $namespace + '-' + $block; diff --git a/src/styles/common/mixins/theme.scss b/src/styles/common/mixins/theme.scss deleted file mode 100644 index a509dcdd..00000000 --- a/src/styles/common/mixins/theme.scss +++ /dev/null @@ -1,25 +0,0 @@ -@import './config.scss'; -@import '../var.scss'; - -$themes: ( - #{$theme-light}: ( - background_color: #cccccc, - //背景色 - background-image: - linear-gradient(120deg, $--color-text-1 0%, $--color-text-1 100%), - //文字 - text-color: #000000a6, - //毛玻璃 - filter-color: $--filter-color-login-light - ), - #{$theme-dark}: ( - background-color: $--color-bg-1, - //背景 - background-image: - linear-gradient(120deg, $--color-bg-1 0%, $--color-bg-2 100%), - //文字 - text-color: $--color-text-3, - //毛玻璃 - filter-color: $--filter-color-login-dark - ) -); diff --git a/src/styles/common/theme.scss b/src/styles/common/theme.scss new file mode 100644 index 00000000..74cd3336 --- /dev/null +++ b/src/styles/common/theme.scss @@ -0,0 +1,10 @@ +@import './mixins/config.scss'; +@import './_dark.scss'; +@import './_light.scss'; + +$themes: ( + // 亮白 + #{$theme-light}: $light, + // 暗黑 + #{$theme-dark}: $dark +); diff --git a/src/styles/common/var.scss b/src/styles/common/var.scss index af7b6ee3..e5a37c31 100644 --- a/src/styles/common/var.scss +++ b/src/styles/common/var.scss @@ -4,19 +4,27 @@ $--color-warn: #fcbc40; $--color-success: #34c749; // 文字 +$--color-text: hsla(0, 0%, 100%, 1); $--color-text-1: hsla(0, 0%, 100%, 0.9); $--color-text-2: hsla(0, 0%, 100%, 0.7); $--color-text-3: hsla(0, 0%, 100%, 0.5); $--color-text-4: hsla(0, 0%, 100%, 0.3); +// 白色 +$--color-light-fill: #fff; +$--color-light-fill-1: #f7f8fa; +$--color-light-fill-2: #f2f3f5; +$--color-light-fill-3: #e5e6eb; +$--color-light-fill-4: #c9cdd4; + // 黑色 -$--color-black: #000; -$--color-border: #333335; -$--color-bg-1: #17171a; -$--color-bg-2: #232324; -$--color-bg-3: #2a2a2b; -$--color-bg-4: #313132; -$--color-bg-5: #373739; +$--color-dark-black: #000; +$--color-dark-bg-1: #17171a; +$--color-dark-bg-2: #232324; +$--color-dark-bg-3: #2a2a2b; +$--color-dark-bg-4: #313132; +$--color-dark-bg-5: #373739; +$--color-dark-border: #333335; // 最大宽度 $--max-width: 1920px; @@ -33,6 +41,6 @@ $--filter-color-login-light: rgba(187, 202, 217, 0.7); // 边框 $--border-radius-base: 8px; -$--border-bottom-style: 1px solid $--color-border; +$--border-bottom-style: 1px solid $--color-dark-border; // 阴影 $--border-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); diff --git a/src/views/login/index.vue b/src/views/login/index.vue index bf4b4cca..4afcd874 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -17,12 +17,7 @@
- - - - - - +
@@ -125,12 +120,9 @@ import { useRouter } from 'vue-router' import { useMessage } from 'naive-ui' import { PersonOutline as PersonOutlineIcon, - LockClosedOutline as LockClosedOutlineIcon, - Moon as MoonIcon, - Sunny as SunnyIcon + LockClosedOutline as LockClosedOutlineIcon } from '@vicons/ionicons5' import { requireUrl } from '@/utils/index' -import { setHtmlTheme } from '@/utils/style' import shuffle from 'lodash/shuffle' import { carouselInterval } from '@/settings/designSetting' import { useDesignStore } from '@/store/modules/designStore/designStore' @@ -188,12 +180,6 @@ const getImageUrl = (name: string, folder: string) => { return requireUrl(`../assets/images/${folder}`, `${name}.png`) } -// 改变样式 -const changeTheme = () => { - designStore.changeTheme() - setHtmlTheme() -} - // 打乱 const shuffleHandle = () => { shuffleTimiing.value = setInterval(() => {