Skip to content

Commit

Permalink
Merge pull request #15135 from calixteman/forced_colors
Browse files Browse the repository at this point in the history
Use default colors only in forced-colors mode (bug 1778068)
  • Loading branch information
calixteman authored Jul 7, 2022
2 parents 657edb3 + fe93742 commit b0a3c9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
5 changes: 5 additions & 0 deletions extensions/chromium/preferences_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@
],
"default": -1
},
"forcePageColors": {
"description": "When enabled, the pdf rendering will use the high contrast mode colors",
"type": "boolean",
"default": false
},
"pageColorsBackground": {
"description": "The color is a string as defined in CSS. Its goal is to help improve readability in high contrast mode",
"type": "string",
Expand Down
12 changes: 8 additions & 4 deletions web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,14 @@ const PDFViewerApplication = {
const container = appConfig.mainContainer,
viewer = appConfig.viewerContainer;
const annotationEditorMode = AppOptions.get("annotationEditorMode");
const pageColors = {
background: AppOptions.get("pageColorsBackground"),
foreground: AppOptions.get("pageColorsForeground"),
};
const pageColors =
AppOptions.get("forcePageColors") ||
window.matchMedia("(forced-colors: active)").matches
? {
background: AppOptions.get("pageColorsBackground"),
foreground: AppOptions.get("pageColorsForeground"),
}
: null;

this.pdfViewer = new PDFViewer({
container,
Expand Down
5 changes: 5 additions & 0 deletions web/app_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ const defaultOptions = {
value: 16777216,
kind: OptionKind.VIEWER,
},
forcePageColors: {
/** @type {boolean} */
value: false,
kind: OptionKind.VIEWER + OptionKind.PREFERENCE,
},
pageColorsBackground: {
/** @type {string} */
value: "Canvas",
Expand Down

0 comments on commit b0a3c9e

Please sign in to comment.