HexColor Generator Using Html Css And Javascript

HexColor Generator Using Html Css And Javascript


Description About HexColor

Hex color is a six-digit code representing the amount of red, green, and blue that makes up the color.

The "hex" part is short for hexadecimal, Hexadecimal is a number system that uses base 16 (as opposed to the decimal system which uses base 10).
Base 16 — or hexadecimal — 
Typically uses characters 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen.

These Are The Characters We Use When Specifying A Color In CSS

Most people in the modern world are used to the decimal system.

As shown in this table, the decimal system (which uses base 10), uses digits that go from zero to nine, then repeats by prepending a 1 to the number (resulting in 10, 11, 12, etc), then when it repeats again, it prepends a 2 (resulting in 20, 21, 23, etc), and then a 3, etc.

The hexadecimal system, on the other hand, doesn't need to repeat until it gets to F.

By the way, it's case-insensitive, so you can use uppercase or lower case letters.

Using Decimal

You can also use the rgb() function to provide the decimal equivalent of a color using the RGB values.

For Example, #FFA500 (orange) would be written as rgb(255,165,0).

Matching Colors between Models

Here's a chart showing how various hex values correspond to the decimal RGB and named color equivalents. 
Click on a value to open a test page using that color.

Hexcolor Generator Script Code

To Gives the HexCode of selected color:

1. To select a color, we will use <input type=”color”> which creates a color picker.

2. Get the value returned by color picker.(Color picker returns hex value)

3. Set the color as background and display the hex code.

Code :
Next Post Previous Post
1 Comments
  • Anonymous
    Anonymous August 11, 2022 at 8:25 PM

    top

Add Comment
comment url