Skip to main content
Colors are of type ColorRef. A ColorRef does not only hold a color: it holds where the color comes from. The chart resolves it when it draws, so a point colored with “the first color of this series” follows the settings of the user, and a theme color follows the light and the dark theme, without recalculating the indicator. This is also what lets an indicator run on the server, which knows neither the theme nor the settings of each user.

Sources of a color

A fixed color.

Changing a color

Both keep the references: a fade between a series color and a parameter still follows both.

Defaults for series and parameters

Use theme colors as defaults, so the indicator looks right on every theme the first time it is added:
Do not use IMethodAPI.GetColorForTheme: it returns the resolved color and exists only on the desktop. GetColorRefForTheme returns the reference and works everywhere.

Where colors are used

A point without a color of its own takes the color of its series. Set point colors only when they change from point to point, and set OverrideAutoColor = true on the series attribute when you do.