Glam Prestige Journal

Bright entertainment trends with youth appeal.

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

For example, on :

PDF in Google Chrome, showing visual state

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:

Google Chrome PDF preview function, with Google Chrome Extension called Dark Reader

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

Custom rendering of ideal setting required by question asker, is not a real browser example, rendering was made in a graphics manipulation program.

Following my asking How can I preview PDFs with Google Chrome in dark mode?, now asking about changing the design for the rest of the screen.

3

2 Answers

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

For example, on (*):Zoom with Dark Reader Google Chrome ExtensionNow 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.

2

There is a way to get the pdf to look the way you want it using Microsoft Edge. If you have Edge in light mode the background of the PDF viewer will be white. By inverting the colors with the code you pasted/using an extension (like Dark Reader), the result you describe can be achieved.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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