Instance Method

colorInvert()

Inverts the colors in this view.

Declaration

func colorInvert() -> some View

Return Value

A view that inverts its colors.

Discussion

The colorInvert() modifier inverts all of the colors in a view so that each color displays as its complementary color. For example, blue converts to yellow, and white converts to black.

The following shows two version of the same image side by side; at left is the original, and at right is a duplicate with its colors inverted:

See Also

Applying Graphical Effects to a View

func opacity(Double) -> View

Sets the transparency of this view.

func brightness(Double) -> View

Brightens this view by the specified amount.

func contrast(Double) -> View

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

func colorMultiply(Color) -> View

Adds a color multiplication effect to this view.

func blendMode(BlendMode) -> View

Sets the blend mode for compositing this view with overlapping views.

func compositingGroup() -> View

Wraps this view in a compositing group.

func drawingGroup(opaque: Bool, colorMode: ColorRenderingMode) -> View

Composites this view’s contents into an offscreen image before final display.

func saturation(Double) -> View

Adjusts the color saturation of this view.

func grayscale(Double) -> View

Adds a grayscale effect to this view.

func hueRotation(Angle) -> View

Applies a hue rotation effect to this view.

func luminanceToAlpha() -> View

Adds a luminance to alpha effect to this view.