> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CheckoutColor

> Swift Structure

**Structure**

A color of the checkout.

```swift theme={null}
struct CheckoutColor
```

Use `color(_:)` for a SwiftUI color, or `uiColor(_:)` for a UIKit color. Use `hex(_:)` for a hex string, or `css(_:)` for a different CSS color value.
Some colors change between light and dark mode, such as `Color.primary`. The checkout uses the value for its mode when it loads. If the mode changes later, the checkout keeps that value.

## Initializers

### init(from:)

Inherited from `Decodable.init(from:)`.

```swift theme={null}
init(from decoder: Decoder) throws
```

## Instance Methods

### encode(to:)

Inherited from `Encodable.encode(to:)`.

```swift theme={null}
func encode(to encoder: Encoder) throws
```

## Type Methods

### color(\_:)

Creates a color from a SwiftUI color, for example `.accentColor`.

```swift theme={null}
static func color(_ color: Color) -> CheckoutColor
```

### css(\_:)

Creates a color from a CSS color value, for example `"rgb(26, 26, 26)"`.

```swift theme={null}
static func css(_ value: String) -> CheckoutColor
```

The SDK sends the value to the checkout as it is.

### hex(\_:)

Creates a color from a hex string, for example `"#1A1A1A"` or `"#1A1A1A80"`.

```swift theme={null}
static func hex(_ value: String) -> CheckoutColor
```

#### Parameters

| Parameter | Description |
| - | - |
| `value` | A `#` and then three, four, six, or eight hex digits. If the value has a different format, the SDK logs an error and sends the value to the checkout as it is. |

### uiColor(\_:)

Creates a color from a UIKit color, for example `.systemBlue`.

```swift theme={null}
static func uiColor(_ color: UIColor) -> CheckoutColor
```
