# Why is the value of clrRed equal to 0x0000FF instead of 0xFF0000

86

```//+------------------------------------------------------------------+
//|                                                     test_RGB.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---
printf("white=0x%.8X",clrWhite);
printf("red=0x%.6X,green=0x%.6X,blue=0x%.6X",clrRed,clrGreen,clrBlue);
}
//+------------------------------------------------------------------+
//test_RGB (USDJPY,M1)  white=0x00FFFFFF
//test_RGB (USDJPY,M1)  red=0x0000FF,green=0x008000,blue=0xFF0000```

Why is the value of clrRed equal to 0x0000FF instead of 0xFF0000 ?

Should the value of clrGreen be 0x00FF00 ?

Thank you.

2292

greentreen:

Why is the value of clrRed equal to 0x0000FF instead of 0xFF0000 ?

The documentation says:

Integer-valued representation is written in a form of hexadecimal or a decimal number. A hexadecimal number looks like 0x00BBGGRR, where RR is the rate of the red color component, GG - of the green one, and BB - of the blue one. Decimal constants are not directly reflected in the RGB. They represent a decimal value of the hexadecimal integer representation.

86

Anthony Garot:

The documentation says:

Integer-valued representation is written in a form of hexadecimal or a decimal number. A hexadecimal number looks like 0x00BBGGRR, where RR is the rate of the red color component, GG - of the green one, and BB - of the blue one. Decimal constants are not directly reflected in the RGB. They represent a decimal value of the hexadecimal integer representation.

Thanks.

So the format of RGB color is 0x00BBGGRR, but the ARGB is 0x00RRGGBB.

https://www.mql5.com/en/docs/convert/colortoargb

Documentation on MQL5: Conversion Functions / ColorToARGB
• www.mql5.com
The function converts color type into uint type to get ARGB representation of the color. ARGB color format is used to generate a graphical resource, text display, as well as for CCanvas standard library class. ARGB format. The value may be set from 0 (a color of a foreground pixel does not change the display of an underlying one) up to 255 (a...
86

The white is 0xFFFFFF,the blue is 0xFF0000,the red is 0x0000FF

white = blue | green | red , so the green should be 0x00FF00,right?

but the value of green is 0x008000, why ?

Just search the hex value of green color, the result here:

it is 0x00FF00

http://www.color-hex.com/color/00ff00

#00ff00 Color Hex Green 1 #0F0
• www.color-hex.com
RGB HSL HSV CMYK XYZ Yxy Hunter Lab CIE-Lab
37446

greentreen:

The white is 0xFFFFFF,the Blue is 0xFF0000,the red is 0x0000FF

white = blue | green | red , so the green should be 0x00FF00,right?

but the value of green is 0x008000, why ?

Just search the hex value of green color, the result here:

it is 0x00FF00

http://www.color-hex.com/color/00ff00

Why not ? clrGreen is just a name.
86

Alain Verleyen:
Why not ? clrGreen is just a name.

Thanks.

Now clrGreen presents a value of 0x008000

The white is 0xFFFFFF,the blue is 0xFF0000,the red is 0x0000FF

white = blue | green | red , so the green should be 0x00FF00,right?

37446

greentreen:

Thanks.

Now clrGreen presents a value of 0x008000

The white is 0xFFFFFF,the blue is 0xFF0000,the red is 0x0000FF

white = blue | green | red , so the green should be 0x00FF00,right?

Yes.

Fortunately they didn't name 0x008000 clrYellow.

86

Alain Verleyen:

Yes.

Fortunately they didn't name 0x008000 clrYellow.

In RGB, the yellow is from the red and green,

clrYellw=  0x00FFFF,it shows the green is 0x00FF00.

But the results shows the green is 0X008000

`test_RGB (USDJPY,M1)  red=0x0000FF,green=0x008000,blue=0xFF0000`
86

I see.

the 0x00FF00 in RGB is clrLime instead of clrGreen.

In short, the G in RGB (MQL5) is presented by clrLime instead of clrGreen.