@@ -85,12 +85,6 @@ const ViewOnLoad = {
85
85
INITIAL : 1 ,
86
86
} ;
87
87
88
- const ViewerCssTheme = {
89
- AUTOMATIC : 0 , // Default value.
90
- LIGHT : 1 ,
91
- DARK : 2 ,
92
- } ;
93
-
94
88
class DefaultExternalServices {
95
89
constructor ( ) {
96
90
throw new Error ( "Cannot initialize DefaultExternalServices." ) ;
@@ -233,7 +227,6 @@ const PDFViewerApplication = {
233
227
if ( AppOptions . get ( "pdfBugEnabled" ) ) {
234
228
await this . _parseHashParams ( ) ;
235
229
}
236
- this . _forceCssTheme ( ) ;
237
230
238
231
// Ensure that the `L10n`-instance has been initialized before creating
239
232
// e.g. the various viewer components.
@@ -347,47 +340,6 @@ const PDFViewerApplication = {
347
340
}
348
341
} ,
349
342
350
- /**
351
- * @private
352
- */
353
- _forceCssTheme ( ) {
354
- const cssTheme = AppOptions . get ( "viewerCssTheme" ) ;
355
- if (
356
- cssTheme === ViewerCssTheme . AUTOMATIC ||
357
- ! Object . values ( ViewerCssTheme ) . includes ( cssTheme )
358
- ) {
359
- return ;
360
- }
361
- try {
362
- const styleSheet = document . styleSheets [ 0 ] ;
363
- const cssRules = styleSheet ?. cssRules || [ ] ;
364
- for ( let i = 0 , ii = cssRules . length ; i < ii ; i ++ ) {
365
- const rule = cssRules [ i ] ;
366
- if (
367
- rule instanceof CSSMediaRule &&
368
- rule . media ?. [ 0 ] === "(prefers-color-scheme: dark)"
369
- ) {
370
- if ( cssTheme === ViewerCssTheme . LIGHT ) {
371
- styleSheet . deleteRule ( i ) ;
372
- return ;
373
- }
374
- // cssTheme === ViewerCssTheme.DARK
375
- const darkRules =
376
- / ^ @ m e d i a \( p r e f e r s - c o l o r - s c h e m e : d a r k \) { \n \s * ( [ \w \s - . , : ; / \\ { } ( ) ] + ) \n } $ / . exec (
377
- rule . cssText
378
- ) ;
379
- if ( darkRules ?. [ 1 ] ) {
380
- styleSheet . deleteRule ( i ) ;
381
- styleSheet . insertRule ( darkRules [ 1 ] , i ) ;
382
- }
383
- return ;
384
- }
385
- }
386
- } catch ( reason ) {
387
- console . error ( `_forceCssTheme: "${ reason ?. message } ".` ) ;
388
- }
389
- } ,
390
-
391
343
/**
392
344
* @private
393
345
*/
0 commit comments