Announcement

Collapse
No announcement yet.

assigning color to a variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • assigning color to a variable

    Quick question: Is it possible to assign a color to a variable? I've tried things like var MyColor = Color.blue to no avail. Perhaps the best that can be done is var MyR = 0; var MyG=0; var MyB=255; and use Color.RGB(MyR, MyG, MyB)?

    I want to have the color of various different bits of text on my charts depend on their values without having to duplicate the whole drawTextAbsolute statement for each color.

  • #2
    Yes, you can do exactly what you described:

    var nColor = Color.blue;

    ...and then use nColor as a parameter to any function (such as the drawText/drawLine functions) that have color parameters.

    Chris

    Comment


    • #3
      Ah, thanks, Chris. I had previously tried that and got an error. I must have done something else stupid -- like leaving out the semi-colon or something. Now I've got it working.

      Comment

      Working...
      X