algorithmicDarkeningAllowed property

bool? algorithmicDarkeningAllowed
getter/setter pair

Control whether algorithmic darkening is allowed.

WebView always sets the media query prefers-color-scheme according to the app's theme attribute isLightTheme, i.e. prefers-color-scheme is light if isLightTheme is true or not specified, otherwise it is dark. This means that the web content's light or dark style will be applied automatically to match the app's theme if the content supports it.

Algorithmic darkening is disallowed by default.

If the app's theme is dark and it allows algorithmic darkening, WebView will attempt to darken web content using an algorithm, if the content doesn't define its own dark styles and doesn't explicitly disable darkening.

NOTE for Android native WebView: available on Android only if WebViewFeature.ALGORITHMIC_DARKENING feature is supported.

Officially Supported Platforms/Implementations:

Implementation

bool? algorithmicDarkeningAllowed;