---
id: "T:cAlgo.API.ChartColorSettings"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/"
---

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

# ChartColorSettings (interface)

Represents the charts Color Settings.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public interface ChartColorSettings
```

## Remarks

Use the Color classes to set the chart Color Settings.

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This indicator allows you to change chart colors via chart controls
    public partial class ChartColorSettingsSample : Indicator
    {
        private TextBox _askPriceLineColorTextBox;

        private TextBox _bidPriceLineColorTextBox;

        private TextBox _backgroundColorTextBox;

        protected override void Initialize()
        {
            var grid = new Grid(10, 2)
            {
                BackgroundColor = Color.Gold,
                Opacity = 0.6,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Bottom
            };

            var style = new Style();

            style.Set(ControlProperty.Margin, 5);
            style.Set(ControlProperty.FontWeight, FontWeight.ExtraBold);
            style.Set(ControlProperty.ForegroundColor, Color.Red);
            style.Set(ControlProperty.MinWidth, 100);

            grid.AddChild(new TextBlock
            {
                Text = "Ask Price Line Color",
                Style = style
            }, 0, 0);

            _askPriceLineColorTextBox = new TextBox
            {
                Text = Chart.ColorSettings.AskPriceLineColor.ToString(),
                Style = style
            };

            grid.AddChild(_askPriceLineColorTextBox, 0, 1);

            grid.AddChild(new TextBlock
            {
                Text = "Bid Price Line Color",
                Style = style
            }, 1, 0);

            _bidPriceLineColorTextBox = new TextBox
            {
                Text = Chart.ColorSettings.BidPriceLineColor.ToString(),
                Style = style
            };

            grid.AddChild(_bidPriceLineColorTextBox, 1, 1);

            grid.AddChild(new TextBlock
            {
                Text = "Background Color",
                Style = style
            }, 2, 0);

            _backgroundColorTextBox = new TextBox
            {
                Text = Chart.ColorSettings.BackgroundColor.ToString(),
                Style = style
            };

            grid.AddChild(_backgroundColorTextBox, 2, 1);

            var changeButton = new Button
            {
                Text = "Change",
                Style = style
            };

            changeButton.Click += ChangeButton_Click;

            grid.AddChild(changeButton, 9, 0);

            Chart.AddControl(grid);
        }

        private void ChangeButton_Click(ButtonClickEventArgs obj)
        {
            Chart.ColorSettings.AskPriceLineColor = GetColor(_askPriceLineColorTextBox.Text);
            Chart.ColorSettings.BidPriceLineColor = GetColor(_bidPriceLineColorTextBox.Text);
            Chart.ColorSettings.BackgroundColor = GetColor(_backgroundColorTextBox.Text);
        }

        private Color GetColor(string colorString, int alpha = 255)
        {
            var color = colorString[0] == '#' ? Color.FromHex(colorString) : Color.FromName(colorString);

            return Color.FromArgb(alpha, color);
        }

        public override void Calculate(int index)
        {
        }
    }
}
```

Python:

```python
import clr
clr.AddReference("cAlgo.API")

from cAlgo.API import *

class Test():
    def get_text_block(self, text):
        textBlock = TextBlock()
        textBlock.Text = text
        textBlock.Style = self.style
        return textBlock

    def get_color(self, colorString, alpha = 255):
        color = Color.FromHex(colorString) if colorString[0] == '#' else Color.FromName(colorString)
        return Color.FromArgb(alpha, color)

    def on_change_button_clicked(self, args):
        api.Chart.ColorSettings.AskPriceLineColor = self.get_color(self.askPriceLineColorTextBox.Text)
        api.Chart.ColorSettings.BidPriceLineColor = self.get_color(self.bidPriceLineColorTextBox.Text)
        api.Chart.ColorSettings.BackgroundColor = self.get_color(self.backgroundColorTextBox.Text)

    def initialize(self):
        grid = Grid(10, 2)
        grid.BackgroundColor = Color.Gold
        grid.Opacity = 0.6
        grid.HorizontalAlignment = HorizontalAlignment.Left
        grid.VerticalAlignment = VerticalAlignment.Bottom

        self.style = Style()

        self.style.Set(ControlProperty.Margin, 5)
        self.style.Set(ControlProperty.FontWeight, FontWeight.ExtraBold)
        self.style.Set(ControlProperty.ForegroundColor, Color.Red)
        self.style.Set(ControlProperty.MinWidth, 100)

        grid.AddChild(self.get_text_block("Ask Price Line Color"), 0, 0)

        self.askPriceLineColorTextBox = self.get_text_block(str(api.Chart.ColorSettings.AskPriceLineColor))

        grid.AddChild(self.askPriceLineColorTextBox, 0, 1)

        grid.AddChild(self.get_text_block("Bid Price Line Color"), 1, 0)

        self.bidPriceLineColorTextBox = self.get_text_block(str(api.Chart.ColorSettings.BidPriceLineColor))
        grid.AddChild(self.bidPriceLineColorTextBox, 1, 1)

        grid.AddChild(self.get_text_block("Background Color"), 2, 0)

        self.backgroundColorTextBox = self.get_text_block(str(api.Chart.ColorSettings.BackgroundColor))
        grid.AddChild(self.backgroundColorTextBox, 2, 1)

        changeButton = Button()
        changeButton.Text = "Change"
        changeButton.Style = self.style
        changeButton.Click += self.on_change_button_clicked

        grid.AddChild(changeButton, 9, 0)

        api.Chart.AddControl(grid)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "IsOverlay": true
}
```

## Properties

- `Color AreaFillColor {get; set;}` — Gets or sets the color of area chart fill. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/AreaFillColor/index.md)
- `Color AskPriceLineColor {get; set;}` — Gets or sets the color of the ask price line. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/AskPriceLineColor/index.md)
- `Color BackgroundColor {get; set;}` — Gets or sets the color of the chart background. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BackgroundColor/index.md)
- `Color BearFillColor {get; set;}` — Gets or sets the color of the bear candle fill. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BearFillColor/index.md)
- `Color BearOutlineColor {get; set;}` — Gets or sets the color of the bear candle or bar outline. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BearOutlineColor/index.md)
- `Color BidPriceLineColor {get; set;}` — Gets or sets the color of the bid price line. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BidPriceLineColor/index.md)
- `Color BullFillColor {get; set;}` — Gets or sets the color of the bull candle fill. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BullFillColor/index.md)
- `Color BullOutlineColor {get; set;}` — Gets or sets the color of the bull candle or bar outline. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BullOutlineColor/index.md)
- `Color BuyColor {get; set;}` — Gets or sets the color of Buy positions and orders. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/BuyColor/index.md)
- `Color ForegroundColor {get; set;}` — Gets or sets the color of the chart foreground. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/ForegroundColor/index.md)
- `Color GridLinesColor {get; set;}` — Gets or sets the color of the grid lines. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/GridLinesColor/index.md)
- `Color LosingDealColor {get; set;}` — Gets or sets the color of the losing deal. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/LosingDealColor/index.md)
- `Color PeriodSeparatorColor {get; set;}` — Gets or sets the color of the period separator. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/PeriodSeparatorColor/index.md)
- `Color SellColor {get; set;}` — Gets or sets the color of Sell order positions and orders. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/SellColor/index.md)
- `Color TickVolumeColor {get; set;}` — Gets or sets the color of the tick volume. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/TickVolumeColor/index.md)
- `Color WinningDealColor {get; set;}` — Gets or sets the color of the winning deal. [details](https://help.ctrader.com/ctrader-algo/references/Chart/ChartColorSettings/WinningDealColor/index.md)

