mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 19:22:52 +02:00
Merge branch 'fix-theme-logic'
This commit is contained in:
commit
2dd5410300
9 changed files with 12 additions and 10 deletions
|
@ -24,7 +24,7 @@ export const themeConfig: ThemeConfig = {
|
|||
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
|
||||
color: {
|
||||
// default theme mode
|
||||
mode: 'light', // light, dark
|
||||
mode: 'light', // light, dark, auto
|
||||
light: {
|
||||
// primary color
|
||||
// used for title, hover, etc
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// default theme mode
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// light mode
|
||||
light: {
|
||||
// primary color
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// modo de tema predeterminado
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// modo claro
|
||||
light: {
|
||||
// color primario
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// デフォルトテーマモード
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// ライトモード
|
||||
light: {
|
||||
// プライマリカラー
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// режим темы по умолчанию
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// светлый режим
|
||||
light: {
|
||||
// основной цвет
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// 默認主題
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// 亮色模式
|
||||
light: {
|
||||
// 高亮顏色
|
||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
|||
```ts
|
||||
color: {
|
||||
// 默认主题
|
||||
mode: 'light' // light, dark
|
||||
mode: 'light' // light, dark, auto
|
||||
// 亮色模式
|
||||
light: {
|
||||
// 高亮颜色
|
||||
|
|
|
@ -110,8 +110,10 @@ function isCurrentDark() {
|
|||
const currentTheme = localStorage.getItem('theme')
|
||||
if (currentTheme)
|
||||
return currentTheme === 'dark'
|
||||
if (defaultMode)
|
||||
return defaultMode === 'dark'
|
||||
if (defaultMode === 'light')
|
||||
return false
|
||||
if (defaultMode === 'dark')
|
||||
return true
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
|
||||
|
|
2
src/types/index.d.ts
vendored
2
src/types/index.d.ts
vendored
|
@ -15,7 +15,7 @@ export interface ThemeConfig {
|
|||
}
|
||||
|
||||
color: {
|
||||
mode: 'light' | 'dark'
|
||||
mode: 'light' | 'dark' | 'auto'
|
||||
light: {
|
||||
primary: string
|
||||
secondary: string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue