Instance Method


Brightens the view by the specified amount.


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



A value between 0 (no effect) and 1 (full white brightening) that represents the intensity of the brightness effect.

Return Value

A view that brightens this view by the specified amount.


Use brightness(_:) to brighten the intensity of the colors in a view. The example below shows a series of red squares, with their brightness increasing from 0 (fully red) to 100% (white) in 20% increments.

struct Brightness: View {
   var body: some View {
       HStack {
           ForEach(0..<6) {
      60, height: 60, alignment: .center)
                    .brightness(Double($0) * 0.2)
                    .overlay(Text("\(Double($0) * 0.2 * 100, specifier: "%.0f")%"),
                            alignment: .bottom)
Rendering showing the effects of brightness adjustments in 20% increments from fully-red to white.

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 contrast(Double) -> View

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

func colorInvert() -> View

Inverts the colors in this view.

func colorMultiply(Color) -> View

Adds a color multiplication effect to this view.

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.