- 1). Find the RGB values of your color. Use a color-picking tool or graphics editing software. In graphics editing software, use the "dropper" tool -- represented by a small eye-dropper icon -- to click on a color in an image. Open the software's color palatte tool -- in graphics programs, double-click on the color swatch in a toolbar -- and view the RGB values. Most color pickers also show the hexadecimal code, eliminating the need to convert RGB values yourself.
- 2). Convert the first value, red, into hexadecimal code, divide it by 16. Take the integer -- the number before the decimal point -- and use that as the first digit for your hexadecimal code. The second digit in the hexadecimal code is the remainder -- the numbers after the decimal point -- times 16. The two numbers you got as a result of converting to hexadecimal code make up the first pair of digits, and that is the red color.
- 3). Convert the green color value to hexadecimal code using the last step's formula. The two resulting digits make up the second pair in the hexadecimal code and represent the color green. Repeat this step for the blue color value to find the last pair of digits for the hexadecimal code. You will end up with six digits total, or three pairs representing red, green and blue. In HTML and CSS code alike, precede any hexadecimal code with the hash "#" symbol.
next post