---
id: "M:cAlgo.API.SvgIcon.#ctor(System.String)"
kind: "constructor"
type: "T:cAlgo.API.SvgIcon"
url: "https://help.ctrader.com/ctrader-algo/references/General/SvgIcon/Constructor/"
---

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

# SvgIcon constructor

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

## SvgIcon(string svgXml)

Creates an SVG icon from raw SVG XML string.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: The SVG is not validated: invalid or oversized SVG is accepted instead of throwing InvalidOperationException as on desktop.
- Cloud: The SVG is not validated: invalid or oversized SVG is accepted instead of throwing InvalidOperationException as on desktop.

C#:

```csharp
public SvgIcon(string svgXml)
```

Python:

```python
SvgIcon(svgXml: str)
```

### Parameters

- `svgXml` (`string`, Python `str`): SVG XML

### Examples

C#:

```csharp
var icon = new SvgIcon("<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M2 14 L8 2 L14 14 Z' fill='#27AE60'/></svg>");
var image = new Image { Source = icon, Width = 32, Height = 32 };
Chart.AddControl(image);
```

Python:

```python
icon = SvgIcon("<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M2 14 L8 2 L14 14 Z' fill='#27AE60'/></svg>")
image = Image()
image.Source = icon
image.Width = 32
image.Height = 32
api.Chart.AddControl(image)
```

