@@ -38,6 +38,7 @@ export type ThemeOptions = false | {
38
38
themes ?: Record < string , ThemeDefinition >
39
39
stylesheetId ?: string
40
40
scope ?: string
41
+ unimportant ?: boolean
41
42
}
42
43
export type ThemeDefinition = DeepPartial < InternalThemeDefinition >
43
44
@@ -49,6 +50,7 @@ interface InternalThemeOptions {
49
50
themes : Record < string , InternalThemeDefinition >
50
51
stylesheetId : string
51
52
scope ?: string
53
+ unimportant : boolean
52
54
}
53
55
54
56
interface VariationsOptions {
@@ -197,6 +199,7 @@ function genDefaults () {
197
199
} ,
198
200
} ,
199
201
stylesheetId : 'vuetify-theme-stylesheet' ,
202
+ unimportant : false ,
200
203
}
201
204
}
202
205
@@ -357,6 +360,7 @@ export function createTheme (options?: ThemeOptions): ThemeInstance & { install:
357
360
358
361
const styles = computed ( ( ) => {
359
362
const lines : string [ ] = [ ]
363
+ const important = parsedOptions . unimportant ? '' : ' !important'
360
364
361
365
if ( current . value ?. dark ) {
362
366
createCssClass ( lines , ':root' , [ 'color-scheme: dark' ] , parsedOptions . scope )
@@ -377,14 +381,14 @@ export function createTheme (options?: ThemeOptions): ThemeInstance & { install:
377
381
const colors = new Set ( Object . values ( computedThemes . value ) . flatMap ( theme => Object . keys ( theme . colors ) ) )
378
382
for ( const key of colors ) {
379
383
if ( key . startsWith ( 'on-' ) ) {
380
- createCssClass ( fgLines , `.${ key } ` , [ `color: rgb(var(--v-theme-${ key } )) ! important` ] , parsedOptions . scope )
384
+ createCssClass ( fgLines , `.${ key } ` , [ `color: rgb(var(--v-theme-${ key } ))${ important } ` ] , parsedOptions . scope )
381
385
} else {
382
386
createCssClass ( bgLines , `.bg-${ key } ` , [
383
387
`--v-theme-overlay-multiplier: var(--v-theme-${ key } -overlay-multiplier)` ,
384
- `background-color: rgb(var(--v-theme-${ key } )) ! important` ,
385
- `color: rgb(var(--v-theme-on-${ key } )) ! important` ,
388
+ `background-color: rgb(var(--v-theme-${ key } ))${ important } ` ,
389
+ `color: rgb(var(--v-theme-on-${ key } ))${ important } ` ,
386
390
] , parsedOptions . scope )
387
- createCssClass ( fgLines , `.text-${ key } ` , [ `color: rgb(var(--v-theme-${ key } )) ! important` ] , parsedOptions . scope )
391
+ createCssClass ( fgLines , `.text-${ key } ` , [ `color: rgb(var(--v-theme-${ key } ))${ important } ` ] , parsedOptions . scope )
388
392
createCssClass ( fgLines , `.border-${ key } ` , [ `--v-border-color: var(--v-theme-${ key } )` ] , parsedOptions . scope )
389
393
}
390
394
}
0 commit comments