WebView2Feedback icon indicating copy to clipboard operation
WebView2Feedback copied to clipboard

put_DefaultBackgroundColor not working when WebView2 is in DarkMode

Open MarkusSchreiner opened this issue 1 year ago • 2 comments

What happened?

I put WebView2 into DarkMode by those two settings:

  • pEnvironmentOptions->put_AdditionalBrowserArguments("--enable-features=WebContentsForceDark:inversion_method/cielab_based/image_behavior/none");
  • pProfile->put_PreferredColorScheme(COREWEBVIEW2_PREFERRED_COLOR_SCHEME_DARK);

When I then want to set the DefaultBackgroundColor via pController3->put_DefaultBackgroundColor(col); // col is COREWEBVIEW2_COLOR the background color does not change.

When WebView2 is in LightMode, put_DefaultBackgroundColor() works as expected.

Importance

Moderate. My app's user experience is affected, but still usable.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

121.0.2277.128

SDK Version

1.0.2088.41

Framework

Win32

Operating System

Windows 10

OS Version

19045.3930

Repro steps

Just initialize WebView2 in DarkMode and then call put_DefaultBackgroundColor()

Repros in Edge Browser

Yes, issue can be reproduced in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

AB#48783037

MarkusSchreiner avatar Feb 23 '24 15:02 MarkusSchreiner

Hi @MarkusSchreiner this is a known issue and we have it on our backlog. Thank you for reporting this, it helps to know that users are actively running into this.

johna-ms avatar Mar 25 '24 22:03 johna-ms

The same problem, more than half a year has passed, and it has not been fixed

simear2004 avatar Jul 26 '24 08:07 simear2004

It seems to me that the recent release is supposed to address this, and yet no official comments of advice?

ajtruckle avatar Jun 10 '25 15:06 ajtruckle

Hi @MarkusSchreiner, @simear2004 & @ajtruckle. The issue is resolved now.

You can refer the doc here.

sivMSFT avatar Jun 11 '25 10:06 sivMSFT

Hi all. I just saw that last entry, and tried to use ICoreWebView2Controller3 for setting the back color.

But, when Edge's Dark-Mode is activated (like in my initial post), the backgorung color still does not change!

Please re-open the issue!

MarkusSchreiner avatar Sep 16 '25 14:09 MarkusSchreiner