Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Windows High Contrast Theme

tad.chen
Posts: 112
Joined: Fri Jan 04, 2019 1:39 am

Re: Windows High Contrast Theme

Post by tad.chen »

I have a different question about dark mode. How to get webpage's background color in dark mode? When browser enables dark mode, the background color is still RGB(255,255,255) which is read in js, but actually it is near to black color.
User avatar
salvadordf
Posts: 4378
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Windows High Contrast Theme

Post by salvadordf »

Hi,

CEF doesn't expose any API call to read the background color in dark mode.

I guess there should be a way to read that value using JavaScript.
tad.chen
Posts: 112
Joined: Fri Jan 04, 2019 1:39 am

Re: Windows High Contrast Theme

Post by tad.chen »

But actually the value of background color read by js is the same no matter in dark mode or not.

The js code is:

Code: Select all

function getPageBackgroundColor() {
  var body = document.body;
  var style = window.getComputedStyle(body);
  return style.backgroundColor;
}

console.log(getPageBackgroundColor());
Post Reply