1- Appearance (Theme) API
1+ DefaultTheme API
22===
33
44# Background
@@ -15,15 +15,15 @@ For reference, in the screenshot below, this API is meant to expose the Overall
1515
1616``` cpp
1717
18- void ViewComponent::SetAppearance (COREWEBVIEW2_APPEARANCE_KIND value)
18+ void ViewComponent::SetDefaultTheme (COREWEBVIEW2_DEFAULTCOLORTHEME_KIND value)
1919{
2020
2121 wil::com_ptr<ICoreWebView2Controller4 > webViewController4;
2222
2323 m_appWindow->GetWebViewController()->QueryInterface(IID_PPV_ARGS(&webViewController4));
2424 if (webViewController4)
2525 {
26- CHECK_FAILURE(webViewController4->put_Appearance (value));
26+ CHECK_FAILURE(webViewController4->put_DefaultTheme (value));
2727 }
2828}
2929
@@ -34,9 +34,9 @@ void ViewComponent::SetAppearance(COREWEBVIEW2_APPEARANCE_KIND value)
3434
3535private WebView2 m_webview;
3636
37- void SetAppearance(COREWEBVIEW2_APPEARANCE_KIND value)
37+ void SetDefaultTheme(COREWEBVIEW2_DEFAULT_THEME_KIND value)
3838{
39- m_webview.CoreWebView2Controller.Appearance = value;
39+ m_webview.CoreWebView2Controller.DefaultTheme = value;
4040}
4141
4242```
@@ -47,38 +47,38 @@ void SetAppearance(COREWEBVIEW2_APPEARANCE_KIND value)
4747[uuid(5f817cce-5d36-4cd0-a1d5-aaaf95c8685f), object, pointer_default(unique)]
4848interface ICoreWebView2Controller4 : ICoreWebView2Controller3 {
4949
50- /// The Appearance property sets the overall theme of the webview2 instance.
51- /// The input parameter is either COREWEBVIEW2_APPEARANCE_KIND_SYSTEM ,
52- /// COREWEBVIEW2_APPEARANCE_KIND_LIGHT , or COREWEBVIEW2_APPEARANCE_KIND_DARK .
50+ /// The DefaultTheme property sets the overall theme of the webview2 instance.
51+ /// The input parameter is either COREWEBVIEW2_DEFAULT_THEME_KIND_SYSTEM ,
52+ /// COREWEBVIEW2_DEFAULT_THEME_KIND_LIGHT , or COREWEBVIEW2_DEFAULT_THEME_KIND_DARK .
5353 /// Note that this API applies appearance to WebView2 pages, dialogs, menus,
5454 /// and sets the media feature `prefers-color-scheme` for websites to respond to.
5555
56- /// Returns the value of the `Appearance ` property.
57- [propget] HRESULT DefaultColorTheme (
58- [out, retval] COREWEBVIEW2_APPEARANCE_KIND * value);
56+ /// Returns the value of the `DefaultTheme ` property.
57+ [propget] HRESULT DefaultTheme (
58+ [out, retval] COREWEBVIEW2_DEFAULT_THEME_KIND * value);
5959
60- /// Sets the `Appearance ` property.
61- [propput] HRESULT Appearance (
62- [in] COREWEBVIEW2_APPEARANCE_KIND value);
60+ /// Sets the `DefaultTheme ` property.
61+ [propput] HRESULT DefaultTheme (
62+ [in] COREWEBVIEW2_DEFAULT_THEME_KIND value);
6363
6464}
6565```
6666```
67- /// An enum to represent the options for WebView2 appearance : system, light, or dark.
67+ /// An enum to represent the options for WebView2 DefaultTheme : system, light, or dark.
6868
6969[v1_enum]
70- typedef enum COREWEBVIEW2_APPEARANCE_KIND {
70+ typedef enum COREWEBVIEW2_DEFAULT_THEME_KIND {
7171
7272 /// System theme
73- COREWEBVIEW2_APPEARANCE_KIND_SYSTEM ,
73+ COREWEBVIEW2_DEFAULT_THEME_KIND_SYSTEM ,
7474
7575 /// Light theme
76- COREWEBVIEW2_APPEARANCE_KIND_LIGHT ,
76+ COREWEBVIEW2_DEFAULT_THEME_KIND_LIGHT ,
7777
7878 /// Dark theme
79- COREWEBVIEW2_APPEARANCE_KIND_DARK
79+ COREWEBVIEW2_DEFAULT_THEME_KIND_DARK
8080
81- } COREWEBVIEW2_APPEARANCE_KIND ;
81+ } COREWEBVIEW2_DEFAULT_THEME_KIND ;
8282
8383```
8484
@@ -87,7 +87,7 @@ typedef enum COREWEBVIEW2_APPEARANCE_KIND {
8787[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2Controller4")]
8888{
8989 // ICoreWebView2Controller4 members
90- CoreWebView2AppearanceKind Appearance { get; set; };
90+ CoreWebView2DefaultThemeKind DefaultTheme { get; set; };
9191
9292}
9393```
0 commit comments