interface ICoreWebView2ExperimentalProfile2
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
Note
This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.
interface ICoreWebView2ExperimentalProfile2
: public IUnknown
This is a continuation of the ICoreWebView2Profile
interface.
Summary
Members | Descriptions |
---|---|
get_PreferredColorScheme | The PreferredColorScheme property sets the overall color scheme of the WebView2s associated with this profile. |
put_PreferredColorScheme | Sets the PreferredColorScheme property. |
Applies to
Product | Introduced |
---|---|
WebView2 Win32 | N/A |
WebView2 Win32 Prerelease | 1.0.1133 |
Members
get_PreferredColorScheme
The PreferredColorScheme property sets the overall color scheme of the WebView2s associated with this profile.
public HRESULT get_PreferredColorScheme(COREWEBVIEW2_PREFERRED_COLOR_SCHEME * value)
This sets the color scheme for WebView2 UI like dialogs, prompts, and context menus by setting the media feature prefers-color-scheme
for websites to respond to.
The default value for this is COREWEBVIEW2_PREFERRED_COLOR_AUTO, which will follow whatever theme the OS is currently set to.
void ViewComponent::SetPreferredColorScheme(COREWEBVIEW2_PREFERRED_COLOR_SCHEME value)
{
wil::com_ptr<ICoreWebView2Experimental8> webViewExperimental8;
webViewExperimental8 = m_webView.try_query<ICoreWebView2Experimental8>();
if (webViewExperimental8)
{
wil::com_ptr<ICoreWebView2ExperimentalProfile> profile;
CHECK_FAILURE(webViewExperimental8->get_Profile(&profile));
auto profileExperimental2 =
profile.try_query<ICoreWebView2ExperimentalProfile2>();
if (profileExperimental2)
{
profileExperimental2->put_PreferredColorScheme(value);
}
}
}
Returns the value of the PreferredColorScheme
property.
put_PreferredColorScheme
Sets the PreferredColorScheme
property.
public HRESULT put_PreferredColorScheme(COREWEBVIEW2_PREFERRED_COLOR_SCHEME value)