---
title: "MTRGBAColor | Mobile sdk | Mobile sdk ios | Ios"
description: "RGBA color represented by 0…255 components."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# MTRGBAColor

```
public struct MTRGBAColor : Sendable, Codable
```

RGBA color represented by 0…255 components.

-   `[red](#/s:11MapTilerSDK11MTRGBAColorV3redSivp)`
    
    Undocumented
    
    #### Declaration
    
    Swift
    
    ```
    public var red: Int
    ```
    
-   `[green](#/s:11MapTilerSDK11MTRGBAColorV5greenSivp)`
    
    Undocumented
    
    #### Declaration
    
    Swift
    
    ```
    public var green: Int
    ```
    
-   `[blue](#/s:11MapTilerSDK11MTRGBAColorV4blueSivp)`
    
    Undocumented
    
    #### Declaration
    
    Swift
    
    ```
    public var blue: Int
    ```
    
-   `[alpha](#/s:11MapTilerSDK11MTRGBAColorV5alphaSiSgvp)`
    
    Undocumented
    
    #### Declaration
    
    Swift
    
    ```
    public var alpha: Int?
    ```
    
-   `[init(red:green:blue:alpha:)](#/s:11MapTilerSDK11MTRGBAColorV3red5green4blue5alphaACSi_S3iSgtcfc)`
    
    Initializes the color with individual components.
    
    #### Declaration
    
    Swift
    
    ```
    public init(red: Int, green: Int, blue: Int, alpha: Int? = nil)
    ```
    
-   `[init(color:)](#/s:11MapTilerSDK11MTRGBAColorV5colorACSo7UIColorC_tcfc)`
    
    Initializes the color from `UIColor`, preserving alpha.
    
    #### Declaration
    
    Swift
    
    ```
    public init(color: UIColor)
    ```
    
-   `[init(from:)](#/s:Se4fromxs7Decoder_p_tKcfc)`
    
    #### Declaration
    
    Swift
    
    ```
    public init(from decoder: any Decoder) throws
    ```
    
-   `[encode(to:)](#/s:SE6encode2toys7Encoder_p_tKF)`
    
    #### Declaration
    
    Swift
    
    ```
    public func encode(to encoder: Encoder) throws
    ```
