thinkScript visual styling

thinkScript Colors

Use Color constants, CreateColor, GetColor, and DefineColor to style plots, labels, and backgrounds in thinkorswim. The full list of 25 standard colors plus copyable code examples for each method.

ColorStudyexcerpt
FastMA.SetDefaultColor(Color.CYAN);
SlowMA.SetDefaultColor(Color.MAGENTA);

AddLabel(yes, "Fast: " + AsText(FastMA),
    if FastMA > SlowMA
    then Color.GREEN
    else Color.RED);
CYAN
MAGENTA
GREEN
RED
YELLOW
Standard colors
25 Color constants
Custom colors
CreateColor with RGB values
Palette colors
GetColor with index 0 to 9

Direct answer

Four ways to use color in thinkScript

thinkScript provides four color mechanisms. Color constants cover the 25 standard colors. CreateColor builds a custom color from RGB values. GetColor picks from a 10-color palette. DefineColor names custom colors on a plot for use with AssignValueColor.

Color constants

Color
# Using Color constants
plot FastMA = Average(close, 9);
plot SlowMA = Average(close, 21);

FastMA.SetDefaultColor(Color.CYAN);
SlowMA.SetDefaultColor(Color.MAGENTA);

AddLabel(yes, "Fast: " + AsText(FastMA),
    if FastMA > SlowMA then Color.GREEN else Color.RED);

Use Color.NAME with SetDefaultColor, AddLabel, or any function that accepts a color.

CreateColor (custom RGB)

CreateColor
# Using CreateColor for custom RGB
plot Price = close;
Price.SetDefaultColor(CreateColor(255, 220, 210));

Pass red, green, and blue values from 0 to 255. Useful when no standard constant matches your design.

GetColor (palette)

GetColor
# Using GetColor from the palette
plot SMA = Average(close, 12);
plot EMA = ExpAverage(close, 12);

SMA.SetDefaultColor(GetColor(1));
EMA.SetDefaultColor(GetColor(5));

Returns a color from the 10-color palette. Colors vary by Look and Feel settings but always ensure readability.

DefineColor (conditional)

DefineColor
# Using DefineColor for conditional coloring
declare lower;
plot Price = close;

Price.DefineColor("Up", Color.UPTICK);
Price.DefineColor("Down", Color.DOWNTICK);
Price.AssignValueColor(
    if Price >= Price[1]
    then Price.Color("Up")
    else Price.Color("Down"));

Define named colors on a plot, then reference them with Price.Color("name") in AssignValueColor.

Full list

All 25 standard Color constants

Each constant is prefixed with Color. in thinkScript. For example, Color.CYAN.

BLACK
BLUE
CYAN
DARK_GRAY
DARK_GREEN
DARK_ORANGE
DARK_RED
GRAY
GREEN
LIGHT_GRAY
LIGHT_GREEN
LIGHT_ORANGE
LIGHT_RED
LIME
MAGENTA
ORANGE
PINK
PLUM
RED
UPTICK
DOWNTICK
VIOLET
WHITE
YELLOW

Frequently asked questions

Style your thinkScript with the right colors

Describe the visual style you want in plain English. The Pineify thinkorswim AI Coding Agent generates a complete thinkScript file with the correct Color constants, custom RGB values, or conditional coloring logic. Review the source, then test it in the Editor.

Open the thinkScript AI agent

This page is for educational and informational purposes. It does not provide investment advice, predict future prices, or guarantee trading results.