
Converting RGB to hexadecimal: RGB values are usually in the range of 0–255 range; if they are in the 0–1 range, these values are multiplied by 255 before conversion occurs. The result is divided by 16 (integer division) which provides the first hexadecimal digit (between 0 and F, where the letters A to F represent the numbers 10 to 15). The remainder provides the second hexadecimal digit. This process would be repeated for each of the three color values needed.