2

How can I change the grey background of the PDF preview in Google Chrome to black?

For example, on https://arxiv.org/pdf/1808.06394.pdf:

enter image description here

using this code in the console (and disabling the Dark Reader Google Chrome extension if it was enabled):

var cover = document.createElement("div");
let css = `
    position: fixed;
    pointer-events: none;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: white;
    mix-blend-mode: difference;
    z-index: 1;
`
cover.setAttribute("style", css);
document.body.appendChild(cover);

I can make the white background black:

enter image description here

However the background of the PDF preview in Google Chrome is still grey. Instead I would like something such as:

enter image description here

3
  • That background you want to change is not a part of the document but the gray part of the document reader itself. I am not clear on how Chrome or Windows would handle that, but it is literally “outside of the box” of what PDF adjustments can handle. Feb 23 '20 at 3:29
  • 1
    @JakeGould I agree. Feb 23 '20 at 3:31
  • How about this plugin? chrome.google.com/webstore/detail/change-colors/… Feb 23 '20 at 4:10
0

Zoom in to Full Page width, or change Window Size, so PDF reaches edge (with Dark Reader from your question):

Zoom with Dark Reader Google Chrome Extension Now you still have the "gray color border" imposed by Google Chrome (whose bright idea was that, was it a full thought? We can blame trees for white paper.), but you're not forced to take that as the full version.

Ideally being a Black background would be obvious, computer code would enable us to disable these unconsciously scripted forms to be self-edited, it's not just a form of accessibility, it's about designing to be accessible in the lowest code logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.