# Examples of conversion

## RGB to Hex

To change the color saved in the RGB system to Hex system, the following steps must be taken:

• the individual values of the numbers for the individual colors (red, green, blue) stored in the decimal system, replace them with hexadecimal values
• combine (glue) the individual hexadecimal values in the following order: red, green, blue

For example:
the color saved as RGB `252,58,108` we replace
`R = 25210 = FC16`
`G = 5810 = 3A16`
`B = 10810 = 6C16`
This means that the color saved in the Hex system is: #FC3A6C

## Hex to RGB

In this case, we proceed as follows:

• take the first two characters and change them from hexadecimal to decimal. This is red
• Take the two middle characters and change them from hexadecimal to decimal. It is green
• take the last two characters and swap them from hexadecimal to decimal. This is blue

For example:
the color saved as Hex `#51C563` we replace
`5116 = 8110 = R`
`C516 = 19710 = G`
`6316 = 9910 = B`

This means that the color saved in the RGB system is: 81,197,99