# RGB and HEX conversions Calculator

RGB to HEXHEX to RGB
<-- Enter RED
<-- Enter GREEN
<-- Enter BLUE

<-- Enter RGB

Calculate the Hex Code from R:100, G:150, B:230 as well as the hue.

Calculate Piece 1 of the Red portion:
 Red Piece 1 = Red - Red mod 16 16

 Red Piece 1 = 100 - 100 mod 16 16

Checking our modulus lesson, we see that 100 mod 16 = 4
 Red Piece 1 = 100 - 4 16

 Red Piece 1 = 96 16

Red Piece 1 = 6
We use the string 0123456789ABCDEF using the letter at position 6
This letter is 6

Calculate Piece 2 of the Red portion:
Red Piece 2 = Red mod 16
Red Piece 2 = 100 mod 16
Red Piece 2 = 4

We use the string 0123456789ABCDEF using the letter at position 4
This letter is 4

Calculate Piece 1 of the Green portion:
 Green Piece 1 = Green - Green mod 16 16

 Green Piece 1 = 150 - 150 mod 16 16

Checking our modulus lesson, we see that 150 mod 16 = 6
 Green Piece 1 = 150 - 6 16

 Green Piece 1 = 144 16

Green Piece 1 = 9
We use the string 0123456789ABCDEF using the letter at position 9
This letter is 9

Calculate Piece 2 of the Green portion:
Green Piece 2 = Green mod 16
Green Piece 2 = 150 mod 16
Green Piece 2 = 6

We use the string 0123456789ABCDEF using the letter at position 6
This letter is 6

Calculate Piece 1 of the Blue portion:
 Blue Piece 1 = Blue - Blue mod 16 16

 Blue Piece 1 = 230 - 230 mod 16 16

Checking our modulus lesson, we see that 230 mod 16 = 6
 Blue Piece 1 = 230 - 6 16

 Blue Piece 1 = 224 16

Blue Piece 1 = 14
We use the string 0123456789ABCDEF using the letter at position 14
This letter is E

Calculate Piece 2 of the Blue portion:
Blue Piece 2 = Blue mod 16
Blue Piece 2 = 230 mod 16
Blue Piece 2 = 6

We use the string 0123456789ABCDEF using the letter at position 6
This letter is 6

Our final RGB to HEX conversion is below:
R:100, G:150, B:2306496E6

Calculate Hue for RGB = (100, 150, 230)
Since B > G > R, we are in the Cyan-Blue region and the formula is below:
 h = 60°(4B - 5(R) - G) B - R

 h = 60°(4(230) - 5(100) - 230) 230 - 100

 h = 190 130

h =