Inverts the colors in the view.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Swift
UI
Declaration
func colorInvert() -> some View
Return Value
A view that inverts its colors.
Discussion
The color
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:
