mirror of
https://github.com/fmhy/edit.git
synced 2026-01-13 07:21:08 +11:00
kill everyone
This commit is contained in:
parent
caacdaa10d
commit
884d63e3c6
2 changed files with 10 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ export class ThemeHandler {
|
||||||
private state = ref<ThemeState>({
|
private state = ref<ThemeState>({
|
||||||
currentTheme: 'color-swarm',
|
currentTheme: 'color-swarm',
|
||||||
currentMode: 'light' as DisplayMode,
|
currentMode: 'light' as DisplayMode,
|
||||||
theme: themeRegistry['color-swarm']
|
theme: null
|
||||||
})
|
})
|
||||||
private amoledEnabled = ref(false)
|
private amoledEnabled = ref(false)
|
||||||
|
|
||||||
|
|
@ -77,6 +77,10 @@ export class ThemeHandler {
|
||||||
if (typeof document === 'undefined') return
|
if (typeof document === 'undefined') return
|
||||||
|
|
||||||
const { currentMode, theme } = this.state.value
|
const { currentMode, theme } = this.state.value
|
||||||
|
if (!theme) {
|
||||||
|
this.applyDOMClasses(currentMode)
|
||||||
|
return
|
||||||
|
}
|
||||||
const modeColors = theme.modes[currentMode]
|
const modeColors = theme.modes[currentMode]
|
||||||
|
|
||||||
this.applyDOMClasses(currentMode)
|
this.applyDOMClasses(currentMode)
|
||||||
|
|
@ -309,10 +313,12 @@ export class ThemeHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ensureColorPickerColors() {
|
private ensureColorPickerColors() {
|
||||||
|
const theme = this.state.value.theme
|
||||||
|
if (!theme) return
|
||||||
// If theme doesn't specify brand colors, force ColorPicker to reapply its selection
|
// If theme doesn't specify brand colors, force ColorPicker to reapply its selection
|
||||||
const currentMode = this.state.value.currentMode
|
const currentMode = this.state.value.currentMode
|
||||||
const modeColors = this.state.value.theme.modes[currentMode]
|
const modeColors = theme.modes[currentMode]
|
||||||
|
|
||||||
if (!modeColors.brand || !modeColors.brand[1]) {
|
if (!modeColors.brand || !modeColors.brand[1]) {
|
||||||
// Trigger a custom event that ColorPicker can listen to
|
// Trigger a custom event that ColorPicker can listen to
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
|
|
|
||||||
|
|
@ -130,5 +130,5 @@ export interface ThemeRegistry {
|
||||||
export interface ThemeState {
|
export interface ThemeState {
|
||||||
currentTheme: string
|
currentTheme: string
|
||||||
currentMode: DisplayMode
|
currentMode: DisplayMode
|
||||||
theme: Theme
|
theme: Theme | null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue