Hexadecimal Colour Numbers
As you probably know computers know about 0's and 1's.
These bits are grouped into bytes - which are 8 bits.
Hexadecimal notation was developed as a convenient way of representing
bytes. Each dexadecimal has 16 posible values (0 to 15).
In base 10 mathematics 24 is 2x10 + 4.
In base 16 mathematics 24 is 2x16 + 4 (36 decimal).
In base 16 mathematics BC is 11x16 + 12 (188 decimal).
Each 8 bit byte has 256 posible values (0 to 255),
which can be represented with two dexadecimals.
Now let's get back to Hexadecimal Colour Numbers,
they take the form: "#rrggbb",
where rr, gg, and
bb are Hexadecimal numbers representing
Red, Green and Blue respectively.
For example: "#ffffff" is White,
"#ff0000" is Red,
"#00ff00" is Green, and
"#0000ff" is Blue.
When the colour value is 0 that colour does not contribute
to the resulting colour, so black is "#000000".
When the colour value is 255 ("ff") the colour is "on full", so
"#ff87ff" is Red(256),Green(135) and Blue(255) - which is pink.
The table below can be used to convert to and from Hexadecimal.
The column (C) is placed before the row (R), for example to convert
135 to Hexadecimal, find it in the table... it's in column 8, row 7,
therefore 135 = 87 Hexadecimal.
| | C
| | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
| 8 | 9 | A | B | C | D | E | F
| | R
| 0 | 0 | 16 | 32 | 48 | 64 | 80 | 96 | 112 | 128 | 144 | 160 | 176 | 192 | 208 | 224 | 240
| | 1 | 1 | 17 | 33 | 49 | 65 | 81 | 97 | 113 | 129 | 145 | 161 | 177 | 193 | 209 | 225 | 241
| | 2 | 2 | 18 | 34 | 50 | 66 | 82 | 98 | 114 | 130 | 146 | 162 | 178 | 194 | 210 | 226 | 242
| | 3 | 3 | 19 | 35 | 51 | 67 | 83 | 99 | 115 | 131 | 147 | 163 | 179 | 195 | 211 | 227 | 243
| | 4 | 4 | 20 | 36 | 52 | 68 | 84 | 100 | 116 | 132 | 148 | 164 | 180 | 196 | 212 | 228 | 244
| | 5 | 5 | 21 | 37 | 53 | 69 | 85 | 101 | 117 | 133 | 149 | 165 | 181 | 197 | 213 | 229 | 245
| | 6 | 6 | 22 | 38 | 54 | 70 | 86 | 102 | 118 | 134 | 150 | 166 | 182 | 198 | 214 | 230 | 246
| | 7 | 7 | 23 | 39 | 55 | 71 | 87 | 103 | 119 | 135 | 151 | 167 | 183 | 199 | 215 | 231 | 247
| | 8 | 8 | 24 | 40 | 56 | 72 | 88 | 104 | 120 | 136 | 152 | 168 | 184 | 200 | 216 | 232 | 248
| | 9 | 9 | 25 | 41 | 57 | 73 | 89 | 105 | 121 | 137 | 153 | 169 | 185 | 201 | 217 | 233 | 249
| | A | 10 | 26 | 42 | 58 | 74 | 90 | 106 | 122 | 138 | 154 | 170 | 186 | 202 | 218 | 234 | 250
| | B | 11 | 27 | 43 | 59 | 75 | 91 | 107 | 123 | 139 | 155 | 171 | 187 | 203 | 219 | 235 | 251
| | C | 12 | 28 | 44 | 60 | 76 | 92 | 108 | 124 | 140 | 156 | 172 | 188 | 204 | 220 | 236 | 252
| | D | 13 | 29 | 45 | 61 | 77 | 93 | 109 | 125 | 141 | 157 | 173 | 189 | 205 | 221 | 237 | 253
| | E | 14 | 30 | 46 | 62 | 78 | 94 | 110 | 126 | 142 | 158 | 174 | 190 | 206 | 222 | 238 | 254
| | F | 15 | 31 | 47 | 63 | 79 | 95 | 111 | 127 | 143 | 159 | 175 | 191 | 207 | 223 | 239 | 255
|
Web document by
Stephen Peter,
S.Peter@unsw.edu.au, last updated 16 Jul 95.
|