---
title: ColorMatrix
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/colormatrix
---

# ColorMatrix

A matrix to use in an RGBA color transformation.

## Declaration

```swift
@frozen struct ColorMatrix
```

## Overview

Overview The matrix has five columns, each with a red, green, blue, and alpha component. You can use the matrix for tasks like creating a color transformation GraphicsContext.Filter for a GraphicsContext using the colorMatrix(_:) method.

## Topics

### Creating an identity matrix

- [init()](swiftui/colormatrix/init().md)

### First column

- [r1](swiftui/colormatrix/r1.md)
- [g1](swiftui/colormatrix/g1.md)
- [b1](swiftui/colormatrix/b1.md)
- [a1](swiftui/colormatrix/a1.md)

### Second column

- [r2](swiftui/colormatrix/r2.md)
- [g2](swiftui/colormatrix/g2.md)
- [b2](swiftui/colormatrix/b2.md)
- [a2](swiftui/colormatrix/a2.md)

### Third column

- [r3](swiftui/colormatrix/r3.md)
- [g3](swiftui/colormatrix/g3.md)
- [b3](swiftui/colormatrix/b3.md)
- [a3](swiftui/colormatrix/a3.md)

### Fourth column

- [r4](swiftui/colormatrix/r4.md)
- [g4](swiftui/colormatrix/g4.md)
- [b4](swiftui/colormatrix/b4.md)
- [a4](swiftui/colormatrix/a4.md)

### Fifth column

- [r5](swiftui/colormatrix/r5.md)
- [g5](swiftui/colormatrix/g5.md)
- [b5](swiftui/colormatrix/b5.md)
- [a5](swiftui/colormatrix/a5.md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Copyable](swift/copyable.md)
- [Equatable](swift/equatable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Applying blur and shadows

- [blur(radius:opaque:)](swiftui/view/blur(radius:opaque:).md)
- [shadow(color:radius:x:y:)](swiftui/view/shadow(color:radius:x:y:).md)
