DynamicColorSchemeKt
public final class DynamicColorSchemeKt
Summary
Public methods |
|
|---|---|
static final @NonNull ColorScheme |
dynamicColorScheme(Creates a dynamic color scheme. |
static final boolean |
isDynamicColorSchemeEnabled(@NonNull Context context)Returns whether the dynamic colors scheme (colors following the current system theme) is enabled. |
Public methods
dynamicColorScheme
public static final @NonNull ColorScheme dynamicColorScheme(
@NonNull Context context,
@NonNull ColorScheme defaultColorScheme
)
Creates a dynamic color scheme.
Use this function to create a color scheme based on the current system theme. If the user changes the system theme, this color scheme will change accordingly. This function checks whether the dynamic color scheme can be used and returns defaultColorScheme otherwise.
| Parameters | |
|---|---|
@NonNull Context context |
The context required to get system resource data. |
@NonNull ColorScheme defaultColorScheme |
The fallback |
isDynamicColorSchemeEnabled
public static final boolean isDynamicColorSchemeEnabled(@NonNull Context context)
Returns whether the dynamic colors scheme (colors following the current system theme) is enabled.
If enabled, and elements or MaterialScope are opted in to using dynamic theme, colors will change whenever system theme changes.