UIColor(MaterialElevation)

@interface UIColor (MaterialElevation)

Provides extension to UIColor for Material Elevation usage.

  • Returns a color that takes the specified elevation value into account. The color is the blended color of Surface and Elevation Overlay in https://material.io/design/color/dark-theme.html#properties Negative elevation is treated as 0. Pattern-based UIColor is not supported.

    Declaration

    Objective-C

    - (nonnull UIColor *)mdc_resolvedColorWithElevation:(CGFloat)elevation;

    Parameters

    elevation

    The @c mdc_absoluteElevation value to use when resolving the color.

  • Returns a color that takes the specified elevation value and traits into account when there is a color appearance difference between current traits and previous traits. When userInterfaceStyle is UIUserInterfaceStyleDark in currentTraitCollection, elevation will be used to resolve the color.

    Negative elevation is treated as 0. Pattern-based UIColor is not supported. UIColor in UIExtendedGrayColorSpace will be resolved to UIExtendedSRGBColorSpace.

    Declaration

    Objective-C

    - (nonnull UIColor *)mdc_resolvedColorWithTraitCollection:
                             (nonnull UITraitCollection *)traitCollection
                                      previousTraitCollection:
                                          (nonnull UITraitCollection *)
                                              previousTraitCollection
                                                    elevation:(CGFloat)elevation;

    Parameters

    traitCollection

    The traits to use when resolving the color.

    previousTraitCollection

    The previous traits to use when comparing color appearance.

    elevation

    The @c mdc_absoluteElevation to use when resolving the color.

  • Returns a color that takes the specified elevation value and traits into account. When userInterfaceStyle is UIUserInterfaceStyleDark in traitCollection, elevation will be used to resolve the color. Negative elevation is treated as 0. Pattern-based UIColor is not supported. UIColor in UIExtendedGrayColorSpace will be resolved to UIExtendedSRGBColorSpace.

    Declaration

    Objective-C

    - (nonnull UIColor *)mdc_resolvedColorWithTraitCollection:
                             (nonnull UITraitCollection *)traitCollection
                                                    elevation:(CGFloat)elevation;

    Parameters

    traitCollection

    The traits to use when resolving the color.

    elevation

    The @c mdc_absoluteElevation to use when resolving the color.