---
id: "T:cAlgo.API.ColorTheme"
kind: "enum"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Application/ColorTheme/"
---

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

# ColorTheme (enum)

Represents the color theme.

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public enum ColorTheme
```

## Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo
{
    // This sample indicator shows how to use ColorTheme Enum which is the color of platform theme on your indicators/cBots
    public partial class ColorThemeSample : Indicator
    {
        protected override void Initialize()
        {
            ChangeChartBackgroundColorBasedOnTheme(Application.ColorTheme);

            Application.ColorThemeChanged += Application_ColorThemeChanged;
        }

        private void Application_ColorThemeChanged(ColorThemeChangeEventArgs obj)
        {
            ChangeChartBackgroundColorBasedOnTheme(obj.ColorTheme);
        }

        private void ChangeChartBackgroundColorBasedOnTheme(ColorTheme colorTheme)
        {
            if (colorTheme == ColorTheme.Dark)
            {
                Chart.ColorSettings.BackgroundColor = Color.White;
            }
            else if (colorTheme == ColorTheme.Light)
            {
                Chart.ColorSettings.BackgroundColor = Color.Black;
            }
        }

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

Python:

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

from cAlgo.API import *

class Test():
    def initialize(self):
        self.change_chart_background_color_based_on_theme(api.Application.ColorTheme)
        api.Application.ColorThemeChanged += self.on_color_theme_changed

    def change_chart_background_color_based_on_theme(self, colorTheme):
        if colorTheme == ColorTheme.Dark:
            api.Chart.ColorSettings.BackgroundColor = Color.White
        elif colorTheme == ColorTheme.Light:
            api.Chart.ColorSettings.BackgroundColor = Color.Black

    def on_color_theme_changed(self, args):
        self.change_chart_background_color_based_on_theme(args.ColorTheme)
```

config.json:

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

## Values

- `ColorTheme.Dark` — The dark color theme.
- `ColorTheme.Light` — The light color theme.

