mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +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 SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> START
|
||||||
color: {
|
color: {
|
||||||
// default theme mode
|
// default theme mode
|
||||||
mode: 'light', // light, dark
|
mode: 'light', // light, dark, auto
|
||||||
light: {
|
light: {
|
||||||
// primary color
|
// primary color
|
||||||
// used for title, hover, etc
|
// used for title, hover, etc
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// default theme mode
|
// default theme mode
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// light mode
|
// light mode
|
||||||
light: {
|
light: {
|
||||||
// primary color
|
// primary color
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// modo de tema predeterminado
|
// modo de tema predeterminado
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// modo claro
|
// modo claro
|
||||||
light: {
|
light: {
|
||||||
// color primario
|
// color primario
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// デフォルトテーマモード
|
// デフォルトテーマモード
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// ライトモード
|
// ライトモード
|
||||||
light: {
|
light: {
|
||||||
// プライマリカラー
|
// プライマリカラー
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// режим темы по умолчанию
|
// режим темы по умолчанию
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// светлый режим
|
// светлый режим
|
||||||
light: {
|
light: {
|
||||||
// основной цвет
|
// основной цвет
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// 默認主題
|
// 默認主題
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// 亮色模式
|
// 亮色模式
|
||||||
light: {
|
light: {
|
||||||
// 高亮顏色
|
// 高亮顏色
|
||||||
|
|
|
@ -41,7 +41,7 @@ site: {
|
||||||
```ts
|
```ts
|
||||||
color: {
|
color: {
|
||||||
// 默认主题
|
// 默认主题
|
||||||
mode: 'light' // light, dark
|
mode: 'light' // light, dark, auto
|
||||||
// 亮色模式
|
// 亮色模式
|
||||||
light: {
|
light: {
|
||||||
// 高亮颜色
|
// 高亮颜色
|
||||||
|
|
|
@ -110,8 +110,10 @@ function isCurrentDark() {
|
||||||
const currentTheme = localStorage.getItem('theme')
|
const currentTheme = localStorage.getItem('theme')
|
||||||
if (currentTheme)
|
if (currentTheme)
|
||||||
return currentTheme === 'dark'
|
return currentTheme === 'dark'
|
||||||
if (defaultMode)
|
if (defaultMode === 'light')
|
||||||
return defaultMode === 'dark'
|
return false
|
||||||
|
if (defaultMode === 'dark')
|
||||||
|
return true
|
||||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
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: {
|
color: {
|
||||||
mode: 'light' | 'dark'
|
mode: 'light' | 'dark' | 'auto'
|
||||||
light: {
|
light: {
|
||||||
primary: string
|
primary: string
|
||||||
secondary: string
|
secondary: string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue