---
id: "M:cAlgo.API.Color.ToHexString"
kind: "method"
type: "T:cAlgo.API.Color"
url: "https://help.ctrader.com/ctrader-algo/references/Utility/Color/ToHexString/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Color.ToHexString

Member of [Color](https://help.ctrader.com/ctrader-algo/references/Utility/Color/index.md).

## ToHexString()

Get the hex string representation of the color.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public string ToHexString()
```

Python:

```python
color.ToHexString() -> str
```

### Returns

`string` — The hex string representation of the color.

### Examples

C#:

```csharp
Print("Background color: {0}", Chart.ColorSettings.BackgroundColor.ToHexString());
```

Python:

```python
api.Print(f"Background color: {api.Chart.ColorSettings.BackgroundColor.ToHexString()}")
```

