Situation: You want to use more colours than the 17 standard TradingView colours in your indicator or strategy.

In this article:

Discussion: hexadecimal colours in TradingView

Besides standard colours, we can also use hexadecimal colour values in TradingView Pine. With those we can specify any colour we want.

Hexadecimal colour values (or, abbreviated, hex colours) consist out of a number sign (#) followed by 6 or 8 digits (TradingView Wiki, 2017a). Those digits are in hexadecimal notation (hence the name hexadecimal colours) and correspond to 3 or 4 character pairs. The values of each pair range from 00 to FF. This notation makes it for hexadecimal colours possible to represent almost 16,8 million different colours (Wikipedia, 2017).

Examples of hexadecimal colours are #008000 (green) and #C0C0C0 (silver). You may also know hexadecimal colours as color literal (TradingView Wiki, 2017c), hex triplets, and web colours (Wikipedia, 2017). They’re also commonly used in website development.

Note: Hexadecimal colour values in TradingView Pine are case-insensitive: we can use them in lower case, upper case, or some combination (TradingView Wiki, 2017a). This means #7B68EE, #7b68ee, and #7b68Ee all specify the medium slate blue colour.
Note: An important benefit of hexadecimal colours is the high amount of precision to specify the exact colour we want (Harris, 2014). They’re also portable since other programs (and even websites) use hexadecimal colours too. Their disadvantages are an uncommon format and being harder to remember than regular colour names.

Overview: hexadecimal colours for TradingView

Since they make so many colours possible, it’s easy to get lost with hexadecimal colours. And so in the tables below we look at enough colours to have plenty of options. But not that much that we get choice paralysis or that they’re only small differences between them.

The tables sort the same hexadecimal colours in different ways to quickly find the colour you’re looking for. Use the following links to quickly jump to a specific colour table:

Note: Use a website like colorhexa.com to find any possible colour, shade, and tint possible.
Tip: TradingView doesn’t always use the exact colour we specified in our script’s code. When we add the same indicator or strategy to the same chart repeatedly, the script’s colours are shifted. That makes it possible to see which plot or drawing belongs to which script. But it also means the script appears in a different colour than we intended.

After we look at the tables with hexadecimal colours, we examine a programming example that plots with hexadecimal colour values.

Hexadecimal colours sorted by lightness

The following table lists hexadecimal colour values sorted from very light to very dark:

Colour name Hexadecimal value Example
White #FFFFFF
White smoke #F5F5F5
Snow #FFFAFA
Misty rose #FFE4E1
Seashell #FFF5EE
Linen #FAF0E6
Antique white #FAEBD7
Blanched almond #FFEBCD
Papaya whip #FFEFD5
Old lace #FDF5E6
Floral white #FFFAF0
Cornsilk #FFF8DC
Lemon chiffon #FFFACD
Beige #F5F5DC
Light goldenrod yellow #FAFAD2
Ivory #FFFFF0
Light yellow #FFFFE0
Honeydew #F0FFF0
Mint cream #F5FFFA
Azure #F0FFFF
Light cyan #E0FFFF
Alice blue #F0F8FF
Lavender #E6E6FA
Ghost white #F8F8FF
Lavender blush #FFF0F5
Gainsboro #DCDCDC
Light grey #D3D3D3
Peach puff #FFDAB9
Bisque #FFE4C4
Navajo white #FFDEAD
Moccasin #FFE4B5
Wheat #F5DEB3
Pale goldenrod #EEE8AA
Pale turquoise #AFEEEE
Pink #FFC0CB
Light pink #FFB6C1
Silver #C0C0C0
Light coral #F08080
Salmon #FA8072
Light salmon #FFA07A
Burly wood #DEB887
Khaki #F0E68C
Light green #90EE90
Pale green #98FB98
Aquamarine #7FFFD4
Powder blue #B0E0E6
Light blue #ADD8E6
SkyBlue #87CEEB
Light sky blue #87CEFA
Light steel blue #B0C4DE
Thistle #D8BFD8
Plum #DDA0DD
Violet #EE82EE
Hot pink #FF69B4
Dark grey #A9A9A9
Rosy brown #BC8F8F
Tomato #FF6347
Dark salmon #E9967A
Coral #FF7F50
Sandy brown #F4A460
Tan #D2B48C
Dark sea green #8FBC8F
Medium aquamarine #66CDAA
Cornflower blue #6495ED
Medium slate blue #7B68EE
Medium purple #9370DB
Orchid #DA70D6
Pale violet red #DB7093
Grey #808080
Indian red #CD5C5C
Red #FF0000
Orange red #FF4500
Peru #CD853F
Dark orange #FF8C00
Orange #FFA500
Gold #FFD700
Dark khaki #BDB76B
Yellow #FFFF00
Yellow green #9ACD32
Green yellow #ADFF2F
Chartreuse #7FFF00
Lime green #32CD32
Lime #00FF00
Spring green #00FF7F
Turquoise #40E0D0
Medium turquoise #48D1CC
Cyan #00FFFF
Aqua #00FFFF
Cadet blue #5F9EA0
Deep sky blue #00BFFF
Dodger blue #1E90FF
Light slate grey #778899
Slate grey #708090
Royal blue #4169E1
Blue #0000FF
Slate blue #6A5ACD
Blue violet #8A2BE2
Medium orchid #BA55D3
Magenta #FF00FF
Fuchsia #FF00FF
Deep pink #FF1493
Dim grey #696969
Brown #A52A2A
Fire brick #B22222
Sienna #A0522D
Chocolate #D2691E
Goldenrod #DAA520
Lawn green #7CFC00
Medium sea green #3CB371
Medium spring green #00FA9A
Light sea green #20B2AA
Dark turquoise #00CED1
Steel blue #4682B4
Medium blue #0000CD
Dark orchid #9932CC
Dark violet #9400D3
Medium violet red #C71585
Crimson #DC143C
Saddle brown #8B4513
Dark goldenrod #B8860B
Olive drab #6B8E23
Dark olive green #556B2F
Forest green #228B22
Sea green #2E8B57
Dark slate blue #483D8B
Dark red #8B0000
Maroon #800000
Olive #808000
Green #008000
Dark slate grey #2F4F4F
Dark cyan #008B8B
Teal #008080
Midnight blue #191970
Dark blue #00008B
Navy #000080
Indigo #4B0082
Dark magenta #8B008B
Purple #800080
Dark green #006400
Black #000000

↑ Back to the hexadecimal colour overview

Hexadecimal colours sorted by hue

The table below lists different hexadecimal colour values sorted by hue (that is, colour shades):

Colour name Hexadecimal value Example
Light pink #FFB6C1
Pink #FFC0CB
Crimson #DC143C
Lavender blush #FFF0F5
Pale violet red #DB7093
Hot pink #FF69B4
Deep pink #FF1493
Medium violet red #C71585
Orchid #DA70D6
Thistle #D8BFD8
Plum #DDA0DD
Violet #EE82EE
Magenta #FF00FF
Fuchsia #FF00FF
Dark magenta #8B008B
Purple #800080
Medium orchid #BA55D3
Dark violet #9400D3
Dark orchid #9932CC
Indigo #4B0082
Blue violet #8A2BE2
Medium purple #9370DB
Medium slate blue #7B68EE
Slate blue #6A5ACD
Dark slate blue #483D8B
Lavender #E6E6FA
Ghost white #F8F8FF
Blue #0000FF
Medium blue #0000CD
Midnight blue #191970
Dark blue #00008B
Navy #000080
Royal blue #4169E1
Cornflower blue #6495ED
Light steel blue #B0C4DE
Light slate grey #778899
Slate grey #708090
Dodger blue #1E90FF
Alice blue #F0F8FF
Steel blue #4682B4
Light sky blue #87CEFA
Sky blue #87CEEB
Deep sky blue #00BFFF
Light blue #ADD8E6
Powder blue #B0E0E6
Cadet blue #5F9EA0
Azure #F0FFFF
Light cyan #E0FFFF
Pale turquoise #AFEEEE
Cyan #00FFFF
Aqua #00FFFF
Dark turquoise #00CED1
Dark slate grey #2F4F4F
Dark cyan #008B8B
Teal #008080
Medium turquoise #48D1CC
Light sea green #20B2AA
Turquoise #40E0D0
Aquamarine #7FFFD4
Medium aquamarine #66CDAA
Medium spring green #00FA9A
Mint cream #F5FFFA
Spring green #00FF7F
Medium sea green #3CB371
Sea green #2E8B57
Honeydew #F0FFF0
Light green #90EE90
Pale green #98FB98
Dark sea green #8FBC8F
Lime green #32CD32
Lime #00FF00
Forest green #228B22
Green #008000
Dark green #006400
Chartreuse #7FFF00
Lawn green #7CFC00
Green yellow #ADFF2F
Dark olive green #556B2F
Yellow green #9ACD32
Olive drab #6B8E23
Beige #F5F5DC
Light goldenrod yellow #FAFAD2
Ivory #FFFFF0
Light yellow #FFFFE0
Yellow #FFFF00
Olive #808000
Dark khaki #BDB76B
Lemon chiffon #FFFACD
Pale goldenrod #EEE8AA
Khaki #F0E68C
Gold #FFD700
Cornsilk #FFF8DC
Goldenrod #DAA520
Dark goldenrod #B8860B
Floral white #FFFAF0
Old lace #FDF5E6
Wheat #F5DEB3
Moccasin #FFE4B5
Orange #FFA500
Papaya whip #FFEFD5
Blanched almond #FFEBCD
Navajo white #FFDEAD
Antique white #FAEBD7
Tan #D2B48C
Burly wood #DEB887
Bisque #FFE4C4
Dark orange #FF8C00
Linen #FAF0E6
Peru #CD853F
Peach puff #FFDAB9
Sandy brown #F4A460
Chocolate #D2691E
Saddle brown #8B4513
Seashell #FFF5EE
Sienna #A0522D
Light salmon #FFA07A
Coral #FF7F50
Orange red #FF4500
Dark salmon #E9967A
Tomato #FF6347
Misty rose #FFE4E1
Salmon #FA8072
Snow #FFFAFA
Light coral #F08080
Rosy brown #BC8F8F
Indian red #CD5C5C
Red #FF0000
Brown #A52A2A
Fire brick #B22222
Dark red #8B0000
Maroon #800000
White #FFFFFF
White smoke #F5F5F5
Gainsboro #DCDCDC
Light grey #D3D3D3
Silver #C0C0C0
Dark grey #A9A9A9
Grey #808080
Dim grey #696969
Black #000000

↑ Back to the hexadecimal colour overview

Hexadecimal colours sorted by saturation

The following table lists hexadecimal colours sorted by intensity:

Colour name Hexadecimal value Example
Snow #FFFAFA
Misty rose #FFE4E1
Seashell #FFF5EE
Blanched almond #FFEBCD
Papaya whip #FFEFD5
Floral white #FFFAF0
Cornsilk #FFF8DC
Lemon chiffon #FFFACD
Ivory #FFFFF0
Light yellow #FFFFE0
Honeydew #F0FFF0
Mint cream #F5FFFA
Azure #F0FFFF
Light cyan #E0FFFF
Alice blue #F0F8FF
Ghost white #F8F8FF
Lavender blush #FFF0F5
Peach puff #FFDAB9
Bisque #FFE4C4
Navajo white #FFDEAD
Moccasin #FFE4B5
Pink #FFC0CB
Light pink #FFB6C1
Light salmon #FFA07A
Aquamarine #7FFFD4
Hot pink #FF69B4
Tomato #FF6347
Coral #FF7F50
Red #FF0000
Orange red #FF4500
Dark orange #FF8C00
Orange #FFA500
Gold #FFD700
Yellow #FFFF00
Green yellow #ADFF2F
Chartreuse #7FFF00
Lime #00FF00
Spring green #00FF7F
Cyan #00FFFF
Aqua #00FFFF
Deep sky blue #00BFFF
Dodger blue #1E90FF
Blue #0000FF
Magenta #FF00FF
Fuchsia #FF00FF
Deep pink #FF1493
Lawn green #7CFC00
Medium spring green #00FA9A
Dark turquoise #00CED1
Medium blue #0000CD
Dark violet #9400D3
Dark red #8B0000
Maroon #800000
Olive #808000
Green #008000
Dark cyan #008B8B
Teal #008080
Dark blue #00008B
Navy #000080
Indigo #4B0082
Dark magenta #8B008B
Purple #800080
Dark green #006400
Salmon #FA8072
Pale green #98FB98
Light sky blue #87CEFA
Old lace #FDF5E6
Light goldenrod yellow #FAFAD2
Sandy brown #F4A460
Medium violet red #C71585
Crimson #DC143C
Dark goldenrod #B8860B
Antique white #FAEBD7
Wheat #F5DEB3
Light coral #F08080
Khaki #F0E68C
Light green #90EE90
Sky blue #87CEEB
Violet #EE82EE
Dark salmon #E9967A
Cornflower blue #6495ED
Medium slate blue #7B68EE
Turquoise #40E0D0
Royal blue #4169E1
Blue violet #8A2BE2
Chocolate #D2691E
Goldenrod #DAA520
Saddle brown #8B4513
Linen #FAF0E6
Lavender #E6E6FA
Pale goldenrod #EEE8AA
Pale turquoise #AFEEEE
Yellow green #9ACD32
Lime green #32CD32
Fire brick #B22222
Light sea green #20B2AA
Dark orchid #9932CC
Olive drab #6B8E23
Forest green #228B22
Midnight blue #191970
Beige #F5F5DC
Burly wood #DEB887
Powder blue #B0E0E6
Light blue #ADD8E6
Medium aquamarine #66CDAA
Medium purple #9370DB
Orchid #DA70D6
Pale violet red #DB7093
Indian red #CD5C5C
Peru #CD853F
Medium turquoise #48D1CC
Slate blue #6A5ACD
Medium orchid #BA55D3
Brown #A52A2A
Sienna #A0522D
Sea green #2E8B57
Light steel blue #B0C4DE
Plum #DDA0DD
Tan #D2B48C
Medium sea green #3CB371
Steel blue #4682B4
Dark khaki #BDB76B
Dark olive green #556B2F
Dark slate blue #483D8B
Thistle #D8BFD8
Rosy brown #BC8F8F
Dark sea green #8FBC8F
Cadet blue #5F9EA0
Dark slate grey #2F4F4F
Light slate grey #778899
Slate grey #708090
White #FFFFFF
White smoke #F5F5F5
Gainsboro #DCDCDC
Light grey #D3D3D3
Silver #C0C0C0
Dark grey #A9A9A9
Grey #808080
Dim grey #696969
Black #000000

↑ Back to the hexadecimal colour overview

Alphabetical list of hexadecimal colours

The table below lists various hexadecimal colours alphabetically, based on colour name:

Colour name Hexadecimal value Example
Alice blue #F0F8FF
Antique white #FAEBD7
Aqua #00FFFF
Aquamarine #7FFFD4
Azure #F0FFFF
Beige #F5F5DC
Bisque #FFE4C4
Black #000000
Blanched almond #FFEBCD
Blue #0000FF
Blue violet #8A2BE2
Brown #A52A2A
Burly wood #DEB887
Cadet blue #5F9EA0
Chartreuse #7FFF00
Chocolate #D2691E
Coral #FF7F50
Cornflower blue #6495ED
Cornsilk #FFF8DC
Crimson #DC143C
Cyan #00FFFF
Dark blue #00008B
Dark cyan #008B8B
Dark goldenrod #B8860B
Dark grey #A9A9A9
Dark green #006400
Dark khaki #BDB76B
Dark magenta #8B008B
Dark olive green #556B2F
Dark orange #FF8C00
Dark orchid #9932CC
Dark red #8B0000
Dark salmon #E9967A
Dark sea green #8FBC8F
Dark slate blue #483D8B
Dark slate grey #2F4F4F
Dark turquoise #00CED1
Dark violet #9400D3
Deep pink #FF1493
Deep sky blue #00BFFF
Dim grey #696969
Dodger blue #1E90FF
Firebrick #B22222
Floral white #FFFAF0
Forest green #228B22
Fuchsia #FF00FF
Gainsboro #DCDCDC
Ghost white #F8F8FF
Gold #FFD700
Goldenrod #DAA520
Grey #808080
Green #008000
Green yellow #ADFF2F
Honeydew #F0FFF0
Hot pink #FF69B4
Indian red #CD5C5C
Indigo #4B0082
Ivory #FFFFF0
Khaki #F0E68C
Lavender #E6E6FA
Lavender blush #FFF0F5
Lawn green #7CFC00
Lemon chiffon #FFFACD
Light blue #ADD8E6
Light coral #F08080
Light cyan #E0FFFF
Light goldenrod yellow #FAFAD2
Light grey #D3D3D3
Light green #90EE90
Light pink #FFB6C1
Light salmon #FFA07A
Light sea green #20B2AA
Light sky blue #87CEFA
Light slate grey #778899
Light steel blue #B0C4DE
Light yellow #FFFFE0
Lime #00FF00
Lime green #32CD32
Linen #FAF0E6
Magenta #FF00FF
Maroon #800000
Medium aquamarine #66CDAA
Medium blue #0000CD
Medium orchid #BA55D3
Medium purple #9370DB
Medium sea green #3CB371
Medium slate blue #7B68EE
Medium spring green #00FA9A
Medium turquoise #48D1CC
Medium violet red #C71585
Midnight blue #191970
Mint cream #F5FFFA
Misty rose #FFE4E1
Moccasin #FFE4B5
Navajo white #FFDEAD
Navy #000080
Old lace #FDF5E6
Olive #808000
Olive drab #6B8E23
Orange #FFA500
Orange red #FF4500
Orchid #DA70D6
Pale goldenrod #EEE8AA
Pale green #98FB98
Pale turquoise #AFEEEE
Pale violet red #DB7093
Papaya whip #FFEFD5
Peach puff #FFDAB9
Peru #CD853F
Pink #FFC0CB
Plum #DDA0DD
Powder blue #B0E0E6
Purple #800080
Red #FF0000
Rosy brown #BC8F8F
Royal blue #4169E1
Saddle brown #8B4513
Salmon #FA8072
Sandy brown #F4A460
Sea green #2E8B57
Sea shell #FFF5EE
Sienna #A0522D
Silver #C0C0C0
Sky blue #87CEEB
Slate blue #6A5ACD
Slate grey #708090
Snow #FFFAFA
Spring green #00FF7F
Steel blue #4682B4
Tan #D2B48C
Teal #008080
Thistle #D8BFD8
Tomato #FF6347
Turquoise #40E0D0
Violet #EE82EE
Wheat #F5DEB3
White #FFFFFF
White smoke #F5F5F5
Yellow #FFFF00
Yellow green #9ACD32

↑ Back to the hexadecimal colour overview

Example: plotting price data with hexadecimal colours

In the example indicator below we plot the instrument’s daily and weekly open, high, and low. We retrieve that data with the security() function alongside the tickerid variable (which returns the instrument’s current symbol) and "W" or "D", depending on whether we want weekly or daily data. After getting that price data we plot the data on the chart with plot(). Each of those 6 different plot() function calls displays the price data with a different hexadecimal colour value. That gives us a nicely coloured chart.

//@version=3
study(title="Recipe - hexadecimal colours", overlay=true)

// Get the instrument's weekly data
weekHigh = security(tickerid, "W", high,
     lookahead=barmerge.lookahead_on)
weekLow  = security(tickerid, "W", low, 
     lookahead=barmerge.lookahead_on)
weekOpen = security(tickerid, "W", open,
     lookahead=barmerge.lookahead_on)

// Get the instrument's daily data
dayHigh = security(tickerid, "D", high,
     lookahead=barmerge.lookahead_on)
dayLow  = security(tickerid, "D", low,
     lookahead=barmerge.lookahead_on)
dayOpen = security(tickerid, "D", open,
     lookahead=barmerge.lookahead_on)

// Plot data with different hexadecimal colours
plot(series=weekHigh, color=#98FB98, linewidth=4)   // Pale green
plot(series=weekLow, color=#FA8072, linewidth=4)    // Salmon red
plot(series=weekOpen, color=#20B2AA, linewidth=4)   // Light sea green

plot(series=dayHigh, color=#7FFF00, linewidth=2)    // Lawn green
plot(series=dayLow, color=#D2691E, linewidth=2)     // Chocolate brown
plot(series=dayOpen, color=#B22222, linewidth=2)    // Fire brick red

The indicator’s plots and their colours look this:

Example: plotting price data in TradingView with different colours

TradingView functions that can use hexadecimal colours

To use a hexadecimal colour, first our script has to perform some plotting, colouring, or drawing. Each of the following functions can use a hexadecimal colour value (TradingView, n.d.):

Function Description
barcolor() Changes the colour of the instrument’s current price bar.
bgcolor() Changes the background colour of the current price bar.
color() Creates a transparent colour from a standard TradingView colour or hexadecimal colour value. We can then use that transparent colour with the other functions in this table.
fill() Fills the chart’s background between two plots or two horizontal lines with a certain colour.
hline() Draws a horizontal line at a fixed price level on the chart in a certain colour.
plot() Plots a series of data on the chart with a multitude of different plots (like line, histogram, and cross plots) in a certain colour.
plotarrow() Draws an up or down arrow on the chart in the specified colour.
plotbar() Plots a standard OHLC bar on the chart in a certain colour.
plotcandle() Plots a candlestick on the chart with the specified colour.
plotchar() Displays a coloured Unicode character on the price chart.
plotshape() Draws a shape (like an arrow, flag, or circle) on the chart in a certain colour.

For other ways to work with colours in TradingView, see colouring with standard colours and creating transparent colours.

Learn more:

  • Besides the hexadecimal colours discussed above, we can also use standard colour variables in TradingView. While there are only 17 different standard colours, they still cover a broad range plus are easy to remember. Another option when colouring in TradingView is to create a transparent colour.
  • Besides standard colours and hexadecimal colours, we can also use the na built-in variable as a ‘colour’. What that does is in effect turn off the plot or drawing on that bar (TradingView Wiki, 2017b).
  • In the tables above we looked at colours specified with 6 hexadecimal digits. But in TradingView we can also use 8 hexadecimal digits. In that case, the last character pair specifies the transparency of the colour.
  • Even though we can specify an exact hexadecimal colour, that colour won’t always appear on the chart. ThatÂ’s because TradingView ‘shifts’ colours when we repeatedly add the same indicator or strategy to the chart. While this helps to keep the different scripts apart, it also means our script can appear in a different colour.

References

Harris, A. (2014). HTML5 and CSS3: All-in-one for Dummies. Hoboken, NJ: John Wiley & Sons.

TradingView (n.d.). Pine Script Language Reference Manual. Retrieved on June 5, 2017, from https://www.tradingview.com/study-script-reference/

TradingView Wiki (2017a, February 27). Literals. Retrieved on June 8, 2017, from https://www.tradingview.com/wiki/Literals

TradingView Wiki (2017b, March 16). Annotation Functions Overview. Retrieved on June 5, 2017, from https://www.tradingview.com/wiki/Annotation_Functions_Overview

TradingView Wiki (2017c, March 24). Type System. Retrieved on June 8, 2017, from https://www.tradingview.com/wiki/Type_System

Wikipedia (2017, May 3). Web colors. Retrieved on June 8, 2017, from https://en.wikipedia.org/w/index.php?title=Web_colors&oldid=778416263