Skip to content

Commit f741a3e

Browse files
small fixes
1 parent 22d6880 commit f741a3e

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

specs/Theme.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ Theme API
22
===
33

44
# Background
5-
This API's main use is to set the overall theme for WebView2. The options are similar to Edge: match the system default theme, change to light theme, or change to dark theme.
6-
This API has 2 main changes relevant to the end users. First, it sets the theme for WebView2 UI like dialogs, prompts, context menu, etc. And second, this API sets the ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) [media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#media_features). Websites typically media query for this setting in order to set CSS themes for light/dark.
5+
This API's main use is to set the overall theme for WebView2's which are associated with a profile. The options are similar to Edge: match the system default theme, change to light theme, or change to dark theme.
6+
This sets the theme for WebView2 UI like dialogs, prompts, and context menus by setting the ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) [media feature](https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#media_features). Websites typically query for this setting in order to set CSS themes for light/dark.
77

88
Please note this API will only set the overall appearance, but not theme as defined in the Edge browser.
99
For reference, in the screenshot below, this API is meant to expose the Overall Appearance section as a WebView2 API.
1010

1111
![Edge Settings Appearance Page](/specs/images/EdgeSettingsAppearance.png)
12+
13+
# Description
14+
We propose extending `CoreWebView2Profile` to include a `Theme` property. This property will apply
15+
to any WebView2's which are associated with this profile.
16+
1217
# Examples
1318

1419
## C++
@@ -63,13 +68,13 @@ void SetTheme(CoreWebView2ThemeKind value)
6368
[uuid(5f817cce-5d36-4cd0-a1d5-aaaf95c8685f), object, pointer_default(unique)]
6469
interface ICoreWebView2Profile3 : ICoreWebView2Profile2 {
6570
/// The Theme property sets the overall theme of the WebView2's associated
66-
/// with this profile. This sets the theme for WebView2 UI like dialogs,
67-
/// prompts, context menus, and so on. Additionally, this sets the
68-
/// ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
71+
/// with this profile. This sets the theme for WebView2 UI like dialogs,
72+
/// prompts, context menus, and so on. Additionally, this sets the
73+
/// ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
6974
/// CSS media feature.
7075
///
7176
/// The default value for this is COREWEBVIEW2_THEME_KIND_SYSTEM, which will
72-
/// follow whatever theme Windows is currently set to.
77+
/// follow whatever theme the OS is currently set to.
7378
///
7479
/// \snippet ViewComponent.cpp SetTheme
7580
/// Returns the value of the `Theme` property.
@@ -117,7 +122,7 @@ namespace Microsoft.Web.WebView2.Core
117122
118123
[interface_name("Microsoft.Web.WebView2.Core.ICoreWebView2Profile3")]
119124
{
120-
[doc_string("The Theme property sets the overall theme of the WebView2's associated with this profile. This sets the theme for WebView2 UI like dialogs, prompts, context menus, and so on. Additionally, this sets the ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS media feature. The default value for this is COREWEBVIEW2_THEME_KIND_SYSTEM, which will follow whatever theme Windows is currently set to.")]
125+
[doc_string("The Theme property sets the overall theme of the WebView2's associated with this profile. This sets the theme for WebView2 UI like dialogs, prompts, context menus, and so on. Additionally, this sets the ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS media feature. The default value for this is COREWEBVIEW2_THEME_KIND_SYSTEM, which will follow whatever theme the OS is currently set to.")]
121126
CoreWebView2ThemeKind Theme { get; set };
122127
}
123128
}

0 commit comments

Comments
 (0)