@@ -18,18 +18,22 @@ import { DEFAULT_DOCK_SESSION_STORE } from '../state/docks'
1818// off the document lets custom backgrounds composite with the host page.
1919const brandingBackground = useBrandingBackground ( )
2020
21+ function applyViewerBackground ( documentElement : HTMLElement , background : string | undefined ) : void {
22+ if ( background === undefined || ! CSS . supports ( 'background' , background ) ) {
23+ documentElement . classList . remove ( 'viewer-background-custom' )
24+ documentElement . style . removeProperty ( '--devframes-viewer-background' )
25+ return
26+ }
27+
28+ documentElement . classList . add ( 'viewer-background-custom' )
29+ documentElement . style . setProperty ( '--devframes-viewer-background' , background )
30+ }
31+
2132watchEffect ( ( ) => {
2233 const el = document . documentElement
2334 el . classList . toggle ( 'dark' , isDark . value )
2435 el . classList . toggle ( 'light' , ! isDark . value )
25-
26- const background = brandingBackground . value
27- const hasValidBackground = background !== undefined && CSS . supports ( 'background' , background )
28- el . classList . toggle ( 'viewer-background-custom' , hasValidBackground )
29- if ( hasValidBackground )
30- el . style . setProperty ( '--devframes-viewer-background' , background )
31- else
32- el . style . removeProperty ( '--devframes-viewer-background' )
36+ applyViewerBackground ( el , brandingBackground . value )
3337} )
3438
3539async function main ( ) : Promise < void > {
0 commit comments