This is only here for
those who really feel
they want to know more on the subject!!
Because
of having ten fingers and ten toes (usually!), the figure
10 has become important as a base unit
for arithmetic. So, when we count up from 1 to 10, we
reach 9 and then put a "1" to the left and
a nought to the right to signify arriving at 10, and
starting a new column for the next series up to 9. The
old "tens" and "units". When we
get to 99, we again add a nought to the right to give
us 100 ---- and so on.
Simple eh? Well - computers, thus far at least, work
on the principle of just two states existing - either
a "0" or a "1" (an "on"
or an "off" state if you like, in switching
terms, or "true" and "false"). In
order to make this useful, a method of deriving many
numeric values from just these two states was implemented,
called "Binary". |
BINARY
-
Quite simply, this is arithmetic to a base 2
instead of 10. So, we count from "0"
to "1" and then we go back to "0"and
carry "1" into a new column to the left. If
we use just a four digit series of binary as an example,
it should be possible to see how this works...........
0000 in binary is of course, in decimal, just
zero. 0001 in binary equates to decimal
"1". Then we have 0010 in binary
(0 + 0 + 2 + 0), which is a decimal "2".
0011 binary (0 + 0 + 2 + 1) is decimal "3".......and
so on. When we reach binary 1111, this is the
same as a decimal value "15" (8 + 4
+ 2 + 1) - see how the base 2 is incrementing?
This so far has looked at just "4 bit" binary
(4 bits is sometimes called a "nibble", or
used to be anyway!). If we go to "8 bit"
binary, then the total value possible in decimal is
255, (128 + 64 + 32 + 16 + 8 + 4 + 2 + 1), but
including
a zero, we have 256 "states"
- and
this 255 looks like - 11111111. This set
of eight bits is, by the way known as a "byte".
Notice how we have the "magic 255" total now,
which you can relate to the color information you may
have read - the "8 bit" color, with
256 states (including zero). |
HEXADECIMAL
-
Right - enough of binary - you'll just have to find
some books to go into this in detail if you want
- same for hex' - we are after all simply touching
on the subject. Hexadecimal is really just a very
compact from of binary and makes for a much tidier
way of writing it.
Instead of masses of "0's" and "1's"
we now work to a base 16 and so compact our
information. Remember how a binary 4 bit
string is 1111 (8 + 4 + 2 + 1) = 15.
Well, if we call this "F" - (necessary
because to get to 15 with only one character) -
we have to "extend" our decimal number
series such that we go, 1................8,9,A,B,C,D,E
& F. Wierd eh? But it works well.
So, we can now show 15 decimal (or 1111
binary) as "F" in hexadecimal.
After we reach "F" we have to "carry"
as usual to continue, but, because we are on base
16, we go as follows - 15 decimal, as
said, is "F" in hex' - but to get
to 16, we "carry" the "F"
one place left and put in a "1"
instead, which signifies a value of 16, and
then a "nought" goes on the right.
Thus, 16 decimal becomes "10"
in hex' (usually shown as 10H). Got it? -
(16 + 0) = 16. Lets show another example
or two........
What would 27 be in hex'? - well 16
into that goes once and so gives a "1"
on the left, leaving remainder 11 on the
right ("units"). 11 in hex is "B".
So, 27 decimal in hex' becomes "1B"
(1BH) (16 + 11) = 27.
"FF" of course is ((16 x 15) +
15) = 255 - again, we have the magic number,
zero being the other state to give a total of 256.
Thus now we can express a "byte" value
as just two characters - very economical.
Try this - what is "D9" hex', in
decimal terms? Well, multiply the left hand element
by 16 - this is therefore (D x 16) = (13
x 16) = 208. To this we add the "units"
element on the right, which is 9, thus giving
(208 + 9) = 217 decimal.
Finally, working the other way from decimal to hex'
- what is 98 in hex'? Well, this time, divide
the figure by 16 - this gives a result of
6 with 2 over ((6x16) + 2), and so
our hex' equivalent is 62H.
Exhausted? - probably! This is only however the
briefest of introductions and is covered at all
just because we have discussed the colors aspect
of web design. If you're more confused than before,
then apologies - it is after all just a surface
scratcher and not really too important unless you
are interested! Nevertheless, it may now just be
possible to appreciate what color values might be,
whether shown in RGB decimal, or RGB hex' notation.
A full blown red, would be shown as either 255,0,0
in decimal, or #FF0000 hex'. 0,153,51 decimal is
#009933 in hex', and this is a web-safe lightish
green - notice the increments referred to in the
description on the "colors" page. Now
- you may go and rest and treat yourself to a drink!
|
OK
- it's boring, perhaps!! I do find though
that from time to time, people ask about this....
if only because of a wish to better understand
some of the basics of computers, and the deeper
aspects of digital imaging and processing.
|
|