# Parse color code

## Description

This operation converts a color code in a supported format to other standard color formats.

This operation accepts a color code as input and automatically detects the format. It then returns the equivalent color in the chosen format. If the input format is invalid or cannot be parsed, the operation returns all fields as empty strings instead of an error.

***

## Supported formats

These are the supported formats for your input strings, as well as the formats you can convert them into:

<table><thead><tr><th width="272.8359375">Format</th><th>Example</th></tr></thead><tbody><tr><td>HEX</td><td><code>#ff0000</code>, <code>ff0000</code></td></tr><tr><td>RGB</td><td><code>rgb(255, 0, 0)</code></td></tr><tr><td>RGBA</td><td><code>rgba(255, 0, 0, 1)</code></td></tr><tr><td>HSL</td><td><code>hsl(0, 100%, 50%)</code></td></tr><tr><td>HSLA</td><td><code>hsla(0, 100%, 50%, 1)</code></td></tr><tr><td>CMYK</td><td><code>cmyk(0.00, 1.00, 1.00, 0.00)</code></td></tr></tbody></table>

***

## Data types

These are the input/output expected data types for this operation:

### Input data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FExtApHuiMxiHgaNWDLb2%2Fimage.png?alt=media\&token=5f4e1372-a2db-4d7e-b81b-976507cac896) - Strings representing the color codes you want to transform.

### Output data

![](https://965373739-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkxZeV4nlXcIAjMGZxzLI%2Fuploads%2FyeZGvHDhYqskHKW5bdnp%2Fimage.png?alt=media\&token=d72665aa-3d46-4572-a463-a62344ee7f88) - The resulting color codes transformed into multiple formats.

***

## Parameters

These are the parameters you need to configure to use this operation (mandatory parameters are marked with a <mark style="color:red;">**\***</mark>):

<details>

<summary>Format color<mark style="color:red;"><strong>*</strong></mark></summary>

Select the format to which you want to convert your input color codes. Choose between:

* **HEX**
* **RGB**
* **RGBA**
* **HSL**
* **HSLA**
* **CMYK**

Refer to the examples in the section above for reference.

</details>

***

## Example

Suppose you want to **transform** your **input color codes** into a **different format**:

1. In your Pipeline, open the required [Action](https://docs.onum.com/the-workspace/pipelines/actions) configuration and select the input **Field**.
2. In the **Operation** field, choose **Parse color code**.
3. Set **Format color** to `RGB`.
4. Give your **Output field** a name and click **Save**. The input color codes will be transformed into the chosen format.

For example:

{% code overflow="wrap" %}

```
"#ff0000" -> "rgb(255, 0, 0)"
```

{% endcode %}

{% hint style="info" %}
You can try out operations with specific values using the **Input** field above the operation. You can enter the value in the example above and check the result in the **Output** field.
{% endhint %}
