Instance Method


Sets the contrast and separation between similar colors in the view.


func contrast(_ amount: Double) -> some View



The intensity of color constrast to apply. Negative values invert colors in addition to applying contrast.

Return Value

A view that applies color contrast to this view.


Apply contrast to a view when you want to increase or decrease the separation between similar colors in the view. The following image shows a photo next to that same photo with the contrast set to 3:

See Also

Applying Graphical Effects to a View

func blur(radius: CGFloat, opaque: Bool) -> View

Applies a Gaussian blur to the view.

func opacity(Double) -> View

Sets the transparency of the view.

func brightness(Double) -> View

Brightens the view by the specified amount.

func colorInvert() -> View

Inverts the colors in the view.

func colorMultiply(Color) -> View

Adds a color multiplication effect to the view.

func saturation(Double) -> View

Adjusts the color saturation of the view.

func grayscale(Double) -> View

Adds a grayscale effect to the view.

func hueRotation(Angle) -> View

Applies a hue rotation effect to the view.

func luminanceToAlpha() -> View

Adds a luminance to alpha effect to the view.