If you were following the last four Articles on Numbering Systems (Decimal, Binary, Octal and Hexadecimal) then here is something for you to play with.  Before that following is the list of Links of those Articles. It is better if you take a look at them before continuing. You will be in a better position to understand it, appreciate the usefulness and can enjoy working with its methods.

  1. Learn Binary Numbering system
  2. Learn Binary Numbering system-2
  3. Octal Numbering System
  4. Hexadecimal Numbering System

colorbinary

 

The above is an image of a MS-Access Form where you can enter a Decimal Number, ranging between 1 and 16777215 (equal to a maximum of 24 Bit Binary Value) and get it converted into Binary Number.  At the same time the number entered into the Text Box will be used for generating the RGB Color that will be displayed at the top color band, where the binary bit positional sequence numbers are shown. Logically you can display a total of over sixteen million colors on the top color band on the form.

If you look closely on the image above, you can see that the value 65535 is entered into the text box and the Binary digits 1111111111111111 are appearing in the grey band above the Text Box.  The decimal value equal to each bit position is in red font color in the labels arranged vertically above the binary digits. If you add up all those red colored values together you will get the result equal to the value in the text box.

Binary bit number 0 to 7 (8 bits) values give the Red Color and bit number 8 to 15 (8 bits) values form the Green Color.  When Red and Green Colors are mixed you will get Yellow Color shown above the Red,Green & Blue Color bands.

Let us make little modification to the above sample color by subtracting some bit values and see how the color changes on the top color band.  Click on the labels with the value 4096 and 64 one by one.  These values are moved into the Text Box and will be subtracted from 65535 (the sample number already appearing in there). The color of the labels changed back to its default color black.  Click on the Command Button with the label Convert. The result value (RGB Number) is appearing in blue color below the text box and the RGB Color of that number is now showing on the top color band. See the image given below:

colorbinary2

If you want to add some more color (Red, Green or Blue) to the existing color number you can click on the labels with numbers in black color, to mix the color above those labels, and click Convert Command Button to show the result on the top band.  The intensity of the color added depends on the magnitude of the number selected from within the respective color band. The color of the label clicked will change to red indicating that the value is added to the color number.

If you click on the labels with red colored font again it will change to black indicating that those values will be subtracted from the color values.  You must click on the Convert Command Button to evaluate the final color value and display the color on the top color band. Every time the Binary digits of those values will also appear in the grey band above the Text Box as well.

To reset everything back to default setting click on the Reset Command Button.

You can use one of the three methods given below or a mix of all the three to enter the number into the Text Box:

  1. Enter a Decimal Number into the Text Box and Click on the Convert Command Button.
  2. Enter a valid expression into the Text Box like 2^10+2^5+5*25+1638 and click Convert Command Button.
  3. Click on the labels showing the binary digit values underneath Red, Green & Blue color bands to pick those color numbers and to mix them together to create a new color. Each value clicked will be added into the Text Box in the form of an expression. Each Label clicked will change its font color to Red indicating it is added to the color number and if any of those labels are clicked again that color value will be subtracted and the label font color will change back to default black.  When done, click Convert Command Button.
  4. You can use a mix of all the three methods given above to input a valid expression to arrive at a valid value between 1 and 16777215 (16777215 = 256 Blue * 256 Green * 256 Red -1)

Get the result in three ways:

  1. The RGB Color equal to the number selected is displayed on the top color band.
  2. The Binary Number.
  3. The RGB Color Number of the top color band.

You can use this Color Number while designing your Forms or Controls to set the Background Color, Foreground Color or Border Color on the Property Sheet of the Form or Control.  If you are a Web Designer you can convert the Color Number into Hexadecimal format and use it on Style Sheets.  You can call the Function HEX$(Decimal Number) in Debug Window to convert it into Hexadecimal value.  Use the color value in 24 bit format like #0000FF for decimal color value 255.

Enter the number 16777215 in the Text Box and click Convert Command Button to change the top color band to white.

You can download a database with the above Form and Programs by clicking on the Download link below:

Technorati Tags: ,


Download Demo Database