Color Contrast
Utility for applying contrast colors to application/activities.
Please note that if you are already using dynamic colors, contrast will be applied automatically on Android U+. This is only needed if you have a branded or custom theme and want to support contrast.
Functions
Link copied to clipboard
open fun applyToActivitiesIfAvailable(@NonNull application: Application, @NonNull colorContrastOptions: ColorContrastOptions)
Applies contrast to all activities by registering a ActivityLifecycleCallbacks to your application.
Link copied to clipboard
open fun applyToActivityIfAvailable(@NonNull activity: Activity, @NonNull colorContrastOptions: ColorContrastOptions)
Applies contrast to the given activity.
Link copied to clipboard
Returns
true
if contrast control is available on the current SDK level.Link copied to clipboard
open fun wrapContextIfAvailable(@NonNull context: Context, @NonNull colorContrastOptions: ColorContrastOptions): Context
Wraps the given context with the theme overlay where color resources are updated.