| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
Webview.SetPreferredColorScheme
Sets the preferred color scheme.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| Webview | 15.5 | ❌ No | ✅ Yes | ❌ No | ❌ No | ❌ No |
MBS( "Webview.SetPreferredColorScheme"; WebViewerRef; Value ) More
Parameters
| Parameter | Description | Example |
|---|---|---|
| WebViewerRef | Either the Web Viewer Object Name or the Web Viewer ID as returned by "WebView.FindByName" function. | |
| Value | The new setting. Pass auto, light or dark. |
"dark" |
Result
Returns OK or error.
Description
Sets the preferred color scheme.The PreferredColorScheme property sets the overall color scheme of the WebView2s associated with this profile.
This sets the color scheme for WebView2 UI like dialogs, prompts, and menus by setting the media feature prefers-color-scheme. The default value for this is "auto", which will follow whatever color scheme the OS is currently set to.
See also
Release notes
- Version 15.5
- Added Webview.GetPreferredColorScheme and Webview.SetPreferredColorScheme functions for Windows.
Blog Entries
This function checks for a license.
Created 1st October 2025, last changed 1st October 2025
Webview.SetDefaultDownloadFolderPath - WinPDF.GeneratePreview