File tree 2 files changed +26
-4
lines changed
2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -516,10 +516,12 @@ const PDFViewerApplication = {
516
516
const container = appConfig . mainContainer ,
517
517
viewer = appConfig . viewerContainer ;
518
518
const annotationEditorMode = AppOptions . get ( "annotationEditorMode" ) ;
519
- const pageColors = {
520
- background : AppOptions . get ( "pageColorsBackground" ) ,
521
- foreground : AppOptions . get ( "pageColorsForeground" ) ,
522
- } ;
519
+ const pageColors = PDFViewerApplication . useUserDefinedColors
520
+ ? {
521
+ background : AppOptions . get ( "pageColorsBackground" ) ,
522
+ foreground : AppOptions . get ( "pageColorsForeground" ) ,
523
+ }
524
+ : null ;
523
525
524
526
this . pdfViewer = new PDFViewer ( {
525
527
container,
@@ -730,6 +732,21 @@ const PDFViewerApplication = {
730
732
return this . externalServices . supportedMouseWheelZoomModifierKeys ;
731
733
} ,
732
734
735
+ get useUserDefinedColors ( ) {
736
+ // 0 - Only with HCM;
737
+ // 1 - Never;
738
+ // 2 - Always.
739
+ const value = this . externalServices . documentColorUse ;
740
+ switch ( value ) {
741
+ case 1 :
742
+ return false ;
743
+ case 2 :
744
+ return true ;
745
+ default :
746
+ return window . matchMedia ( "(forced-colors: active)" ) . matches ;
747
+ }
748
+ } ,
749
+
733
750
initPassiveLoading ( ) {
734
751
if (
735
752
typeof PDFJSDev === "undefined" ||
Original file line number Diff line number Diff line change @@ -429,6 +429,11 @@ class FirefoxExternalServices extends DefaultExternalServices {
429
429
return shadow ( this , "supportedMouseWheelZoomModifierKeys" , support ) ;
430
430
}
431
431
432
+ static get documentColorUse ( ) {
433
+ const support = FirefoxCom . requestSync ( "documentColorUse" ) ;
434
+ return shadow ( this , "documentColorUse" , support ) ;
435
+ }
436
+
432
437
static get isInAutomation ( ) {
433
438
// Returns the value of `Cu.isInAutomation`, which is only `true` when e.g.
434
439
// various test-suites are running in mozilla-central.
You can’t perform that action at this time.
0 commit comments