MCPcopy
hub / github.com/vuetifyjs/vuetify / provideTheme

Function provideTheme

packages/vuetify/src/composables/theme.ts:647–669  ·  view source on GitHub ↗
(props: { theme?: string })

Source from the content-addressed store, hash-verified

645}
646
647export function provideTheme (props: { theme?: string }) {
648 getCurrentInstance('provideTheme')
649
650 const theme = inject(ThemeSymbol, null)
651
652 if (!theme) throw new Error('Could not find Vuetify theme injection')
653
654 const name = toRef(() => props.theme ?? theme.name.value)
655 const current = toRef(() => theme.themes.value[name.value])
656
657 const themeClasses = toRef(() => theme.isDisabled ? undefined : `${theme.prefix}theme--${name.value}`)
658
659 const newTheme: ThemeInstance = {
660 ...theme,
661 name,
662 current,
663 themeClasses,
664 }
665
666 provide(ThemeSymbol, newTheme)
667
668 return newTheme
669}
670
671export function useTheme () {
672 getCurrentInstance('useTheme')

Callers 15

setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90

Calls 2

getCurrentInstanceFunction · 0.90
injectFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…