Skip to main content
v1.2.0

Color settings

LightningChart Python Trader's appearance can be modified in code.


Color themes

Trader has several pre-defined color themes: Cyber Space, Dark Gold, Light, Light Nature, and Turquoise Hexagon. You can define the theme after creating the chart. Alternatively, the theme can be changed in the Color settings menu.

# Setting the color theme during chart creation
trader.set_color_theme('turquoiseHexagon')

Color themes

It should be noted that changing color themes overrides all user-defined colors. For instance, if you have modified the colors of an indicator or a drawing tool, you will lose these modifications. Furthermore, changing themes causes a page reload since the chart has to be re-created in order to modify all the components of the chart. This will cause you to lose all the trading data you have added to the chart. For these reasons, it is recommended to define the color theme when creating the chart, and refrain from changing it afterwards.

Color settings via user interface

Various color settings can be found in the respective menu, brought up by clicking the Color settings button found in the toolbar to the left of the chart. The menu has two tabs. The first tab includes series related settings such as candlestick colors, while the second contains background related options such as color theme and custom background colors.

Setting colors via UI

Colors for individual technical indicators and drawing tools can also be modified. However, this is done via their own settings menus.
For indicators, see Modifying indicators.
For drawing tools, see Modifying drawing tools.

Color settings in code

Every color setting you can do via user interface, can also be done in code. Chart instance has various set...() methods to alter the appearance of the chart.

# Setting various colors
trader.set_positive_body_color('#00FF55')
trader.set_negative_wick_color('#00FF55')
trader.set_line_color('#55FF00')

Note that in LightningChart Python Trader, the color values for respective methods should be given in HEX format e.g. #FFFFFF. If the method doesn't seem to do anything, check the console of your browser, as Trader often informs the user in case the given values are in wrong format.

Colors for individual technical indicators and drawing tools can also be modified in code. Each indicator and tool have their own methods to modify them. For further information, check the respective documentation:
For indicators, see Modifying indicators.
For drawing tools, see Modifying drawing tools.

Custom backgrounds

LightningChart Python Trader allows users to define their own chart backgrounds. Available options include solid fill, linear and radial gradients, as well as image backgrounds. All background options, excluding image settings, can be found in the background tab in the color settings menu. Modifying any of the settings will override the default background with the currently selected fill type.

In code, there are two methods to change the background colors. set_series_background_color changes only the series area color while set_background_color modifies the color of the whole chart including both margin and series areas. The latter affects the series area only if the former has not been set. set_series_background_color method also includes the fill type settings as well as various optional gradient related settings.

# Setting a radial gradient as background.
trader.set_series_background_color(
'#408000',
fillStyle=2,
gradientColor='#000000',
angle=0,
gradientSpeed=0.4,
positionX=1,
positionY=1,
)

# Setting margin area color (and series area color if setSeriesBackgroundColor has not been called).
trader.set_background_color('#001020')

Background settings

Default background can be restored by calling restore_default_background method in code or by clicking Default background button under Clear contents menu.

Images can be set as backgrounds via set_background_image method, which accepts image URL or path as a string. Image backgrounds can currently be set only in code.

# Setting image as chart background.
trader.set_background_image('Image URL or path')