Skip to content

Commit 45077be

Browse files
authored
fix(theme): ability to restore "system" (#21821)
fixes #21819
1 parent 408a95d commit 45077be

File tree

1 file changed

+5
-1
lines changed
  • packages/vuetify/src/composables

1 file changed

+5
-1
lines changed

packages/vuetify/src/composables/theme.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export interface ThemeInstance {
104104
toggle: (themeArray?: [string, string]) => void
105105

106106
readonly isDisabled: boolean
107+
readonly isSystem: Readonly<Ref<boolean>>
107108
readonly themes: Ref<Record<string, InternalThemeDefinition>>
108109

109110
readonly name: Readonly<Ref<string>>
@@ -379,6 +380,8 @@ export function createTheme (options?: ThemeOptions): ThemeInstance & { install:
379380

380381
const current = toRef(() => computedThemes.value[name.value])
381382

383+
const isSystem = toRef(() => _name.value === 'system')
384+
382385
const styles = computed(() => {
383386
const lines: string[] = []
384387
const important = parsedOptions.unimportant ? '' : ' !important'
@@ -485,7 +488,7 @@ export function createTheme (options?: ThemeOptions): ThemeInstance & { install:
485488
}
486489

487490
function change (themeName: string) {
488-
if (!themeNames.value.includes(themeName)) {
491+
if (themeName !== 'system' && !themeNames.value.includes(themeName)) {
489492
consoleWarn(`Theme "${themeName}" not found on the Vuetify theme instance`)
490493
return
491494
}
@@ -522,6 +525,7 @@ export function createTheme (options?: ThemeOptions): ThemeInstance & { install:
522525
cycle,
523526
toggle,
524527
isDisabled: parsedOptions.isDisabled,
528+
isSystem,
525529
name,
526530
themes,
527531
current,

0 commit comments

Comments
 (0)