Change color of label in thinkscript?

zeek

zeek

Active member
2019 Donor
So i have a study which has chart labels but there is no color code when i checked the source. Can anyone help me show what i need to add to the line of code so that i can change the color myself to whatever i want?

This is the line,

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2));
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
So i have a study which has chart labels but there is no color code when i checked the source. Can anyone help me show what i need to add to the line of code so that i can change the color myself to whatever i want?

This is the line,
What are you trying to show? Are you looking for one color or multi color?

This is one color.

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2), color.CYAN);
 
zeek

zeek

Active member
2019 Donor
What are you trying to show? Are you looking for one color or multi color?

This is one color.

AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2), color.CYAN);

I just want the ability to change the color myself using these codes here

Edit: Ok, thanks. I will try and add just like you did in your example.
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
I just want the ability to change the color myself using these codes here

Edit: Ok, thanks. I will try and add just like you did in your example.
Let me know if it works.
 
T

tomsk

Well-known member
VIP
@zeek Here is an example on how to have different colors in your label depending on the value of level1

Code:
AddLabel(showlabels, LEVEL_1 + "%= " + Round(level1, 2),
    if level1 > 80 then Color.Green else if level1 < 40 then Color.Red else Color.Yellow);

You can replace the color with RGB definitions as found in the link you posted, so instead of Color.Green you would have
CreateColor(50,150,250) as an example
 
C

coffeewin

New member
@tomsk is there a way to make a transparent label by using RGBR color format where you can adjust the transparency/opacity levels? The CreateColor documentation seems to only allow RGB.
 

Similar threads

Top