Language

ForceDarkMode Enum

Definition

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. refer to setForceDark(int)

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 android.webkit.WebSettings.FORCE_DARK_OFF.

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. refer to setForceDark(int)

Enable force dark dependent on the state of the WebView parent view. If the WebView parent view is being automatically force darkened (see: View.setForceDarkAllowed(boolean)), 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 android.webkit.WebSettings.FORCE_DARK_AUTO.

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. refer to setForceDark(int)

Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.

Android reference for android.webkit.WebSettings.FORCE_DARK_ON.

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.

Applies to