How can I convert Color to int or the opposite?

 

I made a variable as a color Gcolor_4; and another variable as an int called  int color_6 = 32768;

Now I'd like to put this value from color_6 to Gcolor_4

Like this  Gcolor_4 = color_6_6;

and when compiling I got "possible loss of data due to type conversion"

So how can I fix this conversion .

Regards


 
Documentation on MQL5: Language Basics / Data Types / Integer Types / Color Type
Documentation on MQL5: Language Basics / Data Types / Integer Types / Color Type
  • www.mql5.com
type is intended for storing information about color and occupies 4 bytes in memory. The first byte is ignored, the remaining 3 bytes contain the RGB-components. Literal representation consists of three parts representing numerical rate values of the three main color components: red, green, blue. The constant starts with C and is enclosed in...
 

It's just a warning. I'm not sure but try this:

color Gcolor_4;
int color_6 = 32768;
Gcolor_4 = (color)color_6; // explicit type conversion

This should result in a green color (32768 or in hex 0x008000)

 
lippmaje:

It's just a warning. I'm not sure but try this:

This should result in a green color (32768 or in hex 0x008000)

Thanks lippmaje