Dynamic theme primary color change in theme Vue 3 #17461
-
Was trying to find a way to change the primary color of the theme using a color-picker like so: const myTheme: ThemeDefinition = reactive({
dark: true,
colors: {
primary: '#E9476F'
}
})
In my component:
watch(color, (newColor) => {
theme.themes.value.myTheme = {
...theme.themes.value.myTheme,
colors: {
...theme.themes.value.myTheme.colors,
primary: newColor
}
}
theme.current.value = 'myTheme'
}) This does seem to work, however I get the following TS warning |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
https://vuetifyjs.com/en/features/theme/#theme-object-structure
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the prompt response Kael, and apologies I missed that bit from the docs :) |
Beta Was this translation helpful? Give feedback.
https://vuetifyjs.com/en/features/theme/#theme-object-structure
current
is readonly and not a string, you wantglobal.name