Page 2 of 2
Re: Windows High Contrast Theme
Posted: Sat Oct 12, 2024 7:45 am
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.
Re: Windows High Contrast Theme
Posted: Sun Oct 13, 2024 10:18 am
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.
Re: Windows High Contrast Theme
Posted: Mon Oct 14, 2024 3:13 am
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());