ForceDarkMode Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Selects the legacy force-dark policy for web content.
public enum ForceDarkMode
type ForceDarkMode =
- Inheritance
-
ForceDarkMode
Fields
| Name | Value | Description |
|---|---|---|
| Off | 0 | This constant was deprecated in API level 33. In apps that target API level 33 or later, the force dark mode has no effect. WebView always uses the dark style that the web content defines when the app theme is dark. If the app theme is dark, use AlgorithmicDarkeningAllowed to let WebView darken web content that does not define its own dark styles and does not explicitly disable darkening. Disable force dark, irrespective of the force dark mode of the WebView parent. In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened. Android reference for Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. |
| Auto | 1 | This constant was deprecated in API level 33. In apps that target API level 33 or later, the force dark mode has no effect. WebView always uses the dark style that the web content defines when the app theme is dark. If the app theme is dark, use AlgorithmicDarkeningAllowed to let WebView darken web content that does not define its own dark styles and does not explicitly disable darkening. Enable force dark depending on the state of the WebView parent view. If the WebView parent view is automatically force darkened (see ForceDarkAllowed), then WebView content will be rendered so as to emulate a dark theme. WebViews that are not attached to the view hierarchy will not be inverted. Android reference for Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. |
| On | 2 | This constant was deprecated in API level 33. In apps that target API level 33 or later, the force dark mode has no effect. WebView always uses the dark style that the web content defines when the app theme is dark. If the app theme is dark, use AlgorithmicDarkeningAllowed to let WebView darken web content that does not define its own dark styles and does not explicitly disable darkening. Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme. Android reference for Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. |
Remarks
These values select the policy used by WebSettings.ForceDark. The setting has no effect for apps that target Android 13 or later.