toggleTheme

fun toggleTheme(isSystemInDarkTheme: Boolean, switchMode: ButtonSwitchMode = ButtonSwitchMode.Binary)

Toggles the current theme to its opposite value.

This method initiates a theme change by determining the opposite of the current theme and updating the theme provider. The method prevents multiple simultaneous toggle operations and coordinates with the animation system for smooth transitions.

Parameters

isSystemInDarkTheme

Whether the system is currently in dark theme mode. This parameter is used to determine the opposite theme when the current theme is Theme.System.

switchMode

The mode in which the ThemeAnimationState will switch the UI theme. See the ButtonSwitchMode KDocs for more info.