Skip to content

Commit

Permalink
Update to reflect feedback specs/CoreWebView2ControllerOptions.Defaul…
Browse files Browse the repository at this point in the history
…tBackgroundColor.md
  • Loading branch information
citlalli-z committed Dec 18, 2024
1 parent 9e780e0 commit 1793485
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions specs/CoreWebView2ControllerOptions.DefaultBackgroundColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ applies the color too late.

m_environment->CreateCoreWebView2ControllerWithOptions(
m_mainWindow,
SUCCEEDED(result) ? options4.Get() : options.Get(),
options.Get(),
Callback<ICoreWebView2CreateCoreWebView2ControllerCompletedHandler>(
this, &AppWindow::OnCreateCoreWebView2ControllerCompleted).Get());

Expand All @@ -66,12 +66,14 @@ public MainWindow()
SetDefaultBackgroundColor();
}

private void SetDefaultBackgroundColor()
private async Task
SetDefaultBackgroundColor()
{
CoreWebView2Environment environment = CoreWebView2Environment.CreateAsync();
CoreWebView2Environment environment = await
CoreWebView2Environment.CreateAsync();
CoreWebView2ControllerOptions options = environment.CreateCoreWebView2ControllerOptions();
options.DefaultBackgroundColor = Color.FromArgb(255, 85, 0, 255);
WebView2.EnsureCoreWebView2Async(environment, options);
await WebView2.EnsureCoreWebView2Async(environment, options);
}

```
Expand Down Expand Up @@ -101,10 +103,11 @@ interface ICoreWebView2ControllerOptions4 : ICoreWebView2ControllerOptions3 {
/// the `DefaultBackgroundColor` property to render the background.
/// By default, this color is set to white.
///
/// Currently this API only supports opaque colors and transparency. It will
/// fail for colors with alpha values that don't equal 0 or 255 ie. translucent
/// colors are not supported. When WebView2 is set to have a transparent background,
/// it renders the content of the parent window behind it.
/// Currently this API only supports opaque colors and full transparency. It will
/// fail for colors with alpha values that don't equal 0 or 255.
/// When WebView2 is set to be fully transparent, it does not render a background,
/// allowing the content from windows behind it to be visible.


[propget] HRESULT DefaultBackgroundColor([out, retval] COREWEBVIEW2_COLOR* value);
[propput] HRESULT DefaultBackgroundColor([in] COREWEBVIEW2_COLOR value);
Expand Down

0 comments on commit 1793485

Please sign in to comment.