(Please use a brower which supports JavaScript.)


Color Selection JavaScript Program




Red (R) :
Decimal :Hex
Green (G) :
Decimal :Hex
Blue (B) :
Decimal :Hex



- How to use this color selection program is written below (click here).


Outline

With this JavaScript program (Note 1), you can obtain RGB hexadecimal (hex) red-green-blue triplet to specify colors in HTML documents, including background colors, text (font) colors, and link-related colors.

Colors are composed of three primary colors: red (R), green (G) and blue (B). The intensity of each primary color is in the range of 0 to 255. In HTML documents hexadecimal numbers corresponding to RGB intensities (in decimal number) are used to specify colors.

For example, the color "coral", used for the title of this home page, has RGB values 255, 127 and 80 in decimal number, and FF, 7F and 50 in hexadecimal number, respectively. And the hexadecimal notation of the color "coral" is "#FF7F50" or "#ff7f50". (Both capital and small letters can be used.)


How to use the color selection program

  1. Put a cursor into the left blank of "Red (R): Decimal" and enter a number in the range of 0 to 255.
    Then press the [Tab] key, and a "Hex" (hexadecimal) number corresponding to the number entered will be displayed in the right blank and at the same time the cursor will be moved to the right blank.

  2. Press the [Tab] key again to go down to the next row. Repeat the above procedure for green (G) and blue (B) respectively.

  3. After hexadecimal numbers for RGB are obtained (Note 2), click the [Render] button below with a mouse.
    You can confirm the generated color in the small pop-up window (which has also been generated when your browser has first had access to this URL page) by making it an active window.

    In addition, if this main browser window is adjusted to be smaller in size so that the pop-up window can always be viewed, you can confirm the generated color as soon as the [Render] button is pressed.
Note 1: Source code
The JavaScript source code for color selection used here is quoted from the following book with slight modifications:
Paul Kooros and Michele DeWolfe, "JavaScript", Prima Publishing, 1996, pp. 315-317.

Note 2: Hex values
If the hex value obtained in the right blank is in one digit, change it to a two-digit number by adding 0 (zero) to its left side for use in color specification.
For example, "12" in decimal number equals "C" in hexadecimal number. In such a case, "0C" is used for color specification instead of "C" .

To English Contents:

(Ver. 1.01 1997/01/03)
Copyright (c) Koichi Horiba, 1996