For the people that need to know the equivalents of the RGB color values to the hexadecimal color values I will display a chart for you to see the equivalents. But first let me explain on how you can get the equivalent for each value. Now in order to get the percentage values you will need to divide a triplet-integer notation number, which can range from 0-255 by 255, for example, 215/255 = 0.8431372..... now move the decimal point 2 places to the right, which gives us the percentage value 84.3%, which I rounded down to the nearest tenth. Now when using real numbers, which is the best way to display color, you should be aware that most browsers will ignore the decimal point and will round the value to the nearest number also known as an integer, for example, 84.3% will be rounded to 84%.
Now to get a triplet-integer notation number you will have to multiply a percentage value by 255, for example, 255 x 81% or 81% of 255 = 206.55, which will be between 206 and 207 depending on how you round the percentage value either up or down.
Now I will show you how to convert a hexadecimal notation value to an RGB integer-triplet notation value. Remember your hexadecimal color value should follow the following formula as in the following example, #RRGGBB. Now both RR's represent red, and both GG's represent green, and both BB's stand for blue just to refresh your memory. The formula that you will use to convert the hex value into an RGB integer-triplet notation value is stated below.
- (R x 16) + (R x 1) = R
- (G x 16) + (G x 1) = G
- (B x 16) + (B x 1) = B
As you can see in the example above you will have to multiply the first digit in each color spectrum by the hexadecimal base of 16. One thing to remember is that if you have a digit that is a letter, for example, 'b' you will have to convert it to its number form, which in this case the letter 'b' will equal 11 all the way to 'f', which will equal 15, take this as a reminder in case you forgot. Next, you will have to multiply the second digit of each color spectrum by 1 after that you will have to add both color values, which will represent the color value in RGB integer-triplet notation.
Now I will demonstrate the formula above to give you a better understanding of what I'm talking about. In our example, we will use the hex number color value #aa88c4. Now let me show you how to convert the hexadecimal notation color value into an RGB integer-triplet notation value. Remember to convert each letter to its numeric value, as I will show you in the example on the next page.
- aa = (10 x 16) + (10 x 1) = 170
- 88 = (8 x 16) + (8 x 1) = 136
- c4 = (12 x 16) + (4 x 1) = 196
Now your RGB integer-triplet notation color value that was converted from the hex value will be rgb(170,136,196) both color values will display the color the same.
Now if you want to convert the RGB integer-triplet notation value to a hexadecimal value you will have to divide each value by the hexadecimal base of 16. You will also have to keep each whole number as well as its remainder, as I will explain to you after I show you the formula that is listed below.
- R/16 = R and R
- G/16 = G and G
- B/16 = B and B
Let me show you what I mean with the above formula, lets take the RGB integer-triplet notation color value from earlier, which is rgb(170,136,196) and convert it back to a hexadecimal value as I will show you below.
- 170/16 = 10 and 10
- 136/16 = 8 and 8
- 196/16 = 12 and 4
Now as you can see the answer will be #101088124 when we string all the numbers together but we still have to change the digit 10 to the hex base equivalent, which will be 'a' as well as the digit 12, which will be 'c' so our hex color value will be #aa88c4. Now let me explain in more detail on how we got that value. For the red color value we divided 170 by 16 in which 16 only goes into 170 ten times leaving a remainder of 10. Now for the green value we divided 136 by 16 in which 16 goes into 136 eight times with a remainder of 8 and last but not least the blue color value, which we divided 196 by 16 in which 16 goes into 196 twelve times with a remainder of 4. Now if we string all the values together and convert all the numbers from 10 and up to their hexadecimal base equivalents are answer will be #aa88c4.
One more thing before I continue the hexadecimal value 'f' will display the color the brightest and the hexadecimal value '0' will display the color the darkest.
Now I created a chart that shows the equivalent values for hexadecimal notation, RGB percentage notation and RGB integer-triplet notation. For the percentages, I used fractional numbers that I rounded to the nearest tenth. I converted all 256 numbers for you, somebody give me a cookie or a bottle of gin for this. The chart can be found below.
| Number | Hex | Percentage | Number | Hex | Percentage | Number | Hex | Percentage |
| 0 | 00 | 0% | 86 | 56 | 33.7% | 172 | ac | 67.5% |
| 1 | 01 | 0.4% | 87 | 57 | 34.1% | 173 | ad | 67.8% |
| 2 | 02 | 0.8% | 88 | 58 | 34.5% | 174 | ae | 68.2% |
| 3 | 03 | 1.2% | 89 | 59 | 34.9% | 175 | af | 68.6% |
| 4 | 04 | 1.6% | 90 | 5a | 35.3% | 176 | b0 | 69% |
| 5 | 05 | 2% | 91 | 5b | 35.7% | 177 | b1 | 69.4% |
| 6 | 06 | 2.4% | 92 | 5c | 36% | 178 | b2 | 69.8% |
| 7 | 07 | 2.7% | 93 | 5d | 36.5% | 179 | b3 | 70.2% |
| 8 | 08 | 3% | 94 | 5e | 36.9% | 180 | b4 | 70.6% |
| 9 | 09 | 3.5% | 95 | 5f | 37.3% | 181 | b5 | 71% |
| 10 | 0a | 3.9% | 96 | 60 | 37.6% | 182 | b6 | 71.4% |
| 11 | 0b | 4.3% | 97 | 61 | 38% | 183 | b7 | 71.8% |
| 12 | 0c | 4.7% | 98 | 62 | 38.4% | 184 | b8 | 72.2% |
| 13 | 0d | 5.1% | 99 | 63 | 38.8% | 185 | b9 | 72.5% |
| 14 | 0e | 5.5% | 100 | 64 | 39.2% | 186 | ba | 72.9% |
| 15 | 0f | 5.9% | 101 | 65 | 39.6% | 187 | bb | 73.3% |
| 16 | 10 | 6.3% | 102 | 66 | 40% | 188 | bc | 73.7% |
| 17 | 11 | 6.7% | 103 | 67 | 40.4% | 189 | bd | 74.1% |
| 18 | 12 | 7.1% | 104 | 68 | 40.8% | 190 | be | 74.5% |
| 19 | 13 | 7.5% | 105 | 69 | 41.1% | 191 | bf | 74.9% |
| 20 | 14 | 7.8% | 106 | 6a | 41.6% | 192 | c0 | 75.3% |
| 21 | 15 | 8.2% | 107 | 6b | 42% | 193 | c1 | 75.7% |
| 22 | 16 | 8.6% | 108 | 6c | 42.4% | 194 | c2 | 76% |
| 23 | 17 | 9% | 109 | 6d | 42.7% | 195 | c3 | 76.5% |
| 24 | 18 | 9.4% | 110 | 6e | 43.1% | 196 | c4 | 76.9% |
| 25 | 19 | 9.8% | 111 | 6f | 43.5% | 197 | c5 | 77.3% |
| 26 | 1a | 10.2% | 112 | 70 | 43.9% | 198 | c6 | 77.6% |
| 27 | 1b | 10.6% | 113 | 71 | 44.3% | 199 | c7 | 78% |
| 28 | 1c | 11% | 114 | 72 | 44.7% | 200 | c8 | 78.4% |
| 29 | 1d | 11.4% | 115 | 73 | 45.1% | 201 | c9 | 78.8% |
| 30 | 1e | 11.8% | 116 | 74 | 45.5% | 202 | ca | 79.2% |
| 31 | 1f | 12.2% | 117 | 75 | 45.9% | 203 | cb | 79.6% |
| 32 | 20 | 12.5% | 118 | 76 | 46.3% | 204 | cc | 80% |
| 33 | 21 | 12.9% | 119 | 77 | 46.7% | 205 | cd | 80.4% |
| 34 | 22 | 13.3% | 120 | 78 | 47.1% | 206 | ce | 80.8% |
| 35 | 23 | 13.7% | 121 | 79 | 47.5% | 207 | cf | 81.2% |
| 36 | 24 | 14.1% | 122 | 7a | 47.8% | 208 | d0 | 81.6% |
| 37 | 25 | 14.5% | 123 | 7b | 48.2% | 209 | d1 | 82% |
| 38 | 26 | 14.9% | 124 | 7c | 48.6% | 210 | d2 | 82.4% |
| 39 | 27 | 15.3% | 125 | 7d | 49% | 211 | d3 | 82.7% |
| 40 | 28 | 15.7% | 126 | 7e | 49.4% | 212 | d4 | 83.1% |
| 41 | 29 | 16.1% | 127 | 7f | 49.8% | 213 | d5 | 83.5% |
| 42 | 2a | 16.5% | 128 | 80 | 50.2% | 214 | d6 | 83.9% |
| 43 | 2b | 16.9% | 129 | 81 | 50.6% | 215 | d7 | 84.3% |
| 44 | 2c | 17.3% | 130 | 82 | 51% | 216 | d8 | 84.7% |
| 45 | 2d | 17.6% | 131 | 83 | 51.4% | 217 | d9 | 85.1% |
| 46 | 2e | 18% | 132 | 84 | 51.8% | 218 | da | 85.5% |
| 47 | 2f | 18.4% | 133 | 85 | 52.2% | 219 | db | 85.9% |
| 48 | 30 | 18.8% | 134 | 86 | 52.5% | 220 | dc | 86.3% |
| 49 | 31 | 19.2% | 135 | 87 | 52.9% | 221 | dd | 86.7% |
| 50 | 32 | 19.6% | 136 | 88 | 53.3% | 222 | de | 87.1% |
| 51 | 33 | 20% | 137 | 89 | 53.7% | 223 | df | 87.5% |
| 52 | 34 | 20.4% | 138 | 8a | 54.1% | 224 | e0 | 87.8% |
| 53 | 35 | 20.8% | 139 | 8b | 54.5% | 225 | e1 | 88.2% |
| 54 | 36 | 21.2% | 140 | 8c | 54.9% | 226 | e2 | 88.6% |
| 55 | 37 | 21.6% | 141 | 8d | 55.3% | 227 | e3 | 89% |
| 56 | 38 | 22% | 142 | 8e | 55.7% | 228 | e4 | 89.4% |
| 57 | 39 | 22.4% | 143 | 8f | 56.1% | 229 | e5 | 89.8% |
| 58 | 3a | 22.8% | 144 | 90 | 56.5% | 230 | e6 | 90.2% |
| 59 | 3b | 23.1% | 145 | 91 | 56.9% | 231 | e7 | 90.6% |
| 60 | 3c | 23.5% | 146 | 92 | 57.3% | 232 | e8 | 91% |
| 61 | 3d | 23.9% | 147 | 93 | 57.6% | 233 | e9 | 91.4% |
| 62 | 3e | 24.3% | 148 | 94 | 58% | 234 | ea | 91.8% |
| 63 | 3f | 24.7% | 149 | 95 | 58.4% | 235 | eb | 92.2% |
| 64 | 40 | 25.1% | 150 | 96 | 58.8% | 236 | ec | 92.5% |
| 65 | 41 | 25.5% | 151 | 97 | 59.2% | 237 | ed | 92.9% |
| 66 | 42 | 25.9% | 152 | 98 | 59.6% | 238 | ee | 93.3% |
| 67 | 43 | 26.3% | 153 | 99 | 60% | 239 | ef | 93.7% |
| 68 | 44 | 26.7% | 154 | 9a | 60.4% | 240 | f0 | 94.1% |
| 69 | 45 | 27.1% | 155 | 9b | 60.8% | 241 | f1 | 94.5% |
| 70 | 46 | 27.5% | 156 | 9c | 61.2% | 242 | f2 | 94.9% |
| 71 | 47 | 27.8% | 157 | 9d | 61.6% | 243 | f3 | 95.3% |
| 72 | 48 | 28.2% | 158 | 9e | 62% | 244 | f4 | 95.7% |
| 73 | 49 | 28.6% | 159 | 9f | 62.4% | 245 | f5 | 96.1% |
| 74 | 4a | 29% | 160 | a0 | 62.7% | 246 | f6 | 96.5% |
| 75 | 4b | 29.4% | 161 | a1 | 63.1% | 247 | f7 | 96.9% |
| 76 | 4c | 29.8% | 162 | a2 | 63.5% | 248 | f8 | 97.3% |
| 77 | 4d | 30.2% | 163 | a3 | 63.9% | 249 | f9 | 97.6% |
| 78 | 4e | 30.6% | 164 | a4 | 64.3% | 250 | fa | 98% |
| 79 | 4f | 31% | 165 | a5 | 64.7% | 251 | fb | 98.4% |
| 80 | 50 | 31.4% | 166 | a6 | 65.1% | 252 | fc | 98.8% |
| 81 | 51 | 31.8% | 167 | a7 | 65.5% | 253 | fd | 99.2% |
| 82 | 52 | 32.2% | 168 | a8 | 65.9% | 254 | fe | 99.6% |
| 83 | 53 | 32.5% | 169 | a9 | 66.3% | 255 | ff | 100% |
| 84 | 54 | 32.9% | 170 | aa | 66.7% | |||
| 85 | 55 | 33.3% | 171 | ab | 67.1% |
discuss this topic to forum
