HTML color codes

HTML color codes is used to set diferent color in web pages to look better. HTML color codes can be represented by hexadecimal number or alphabets.

The most used Color codes are Hex codes. Hex codes are three-byte hexadecimal numbers which consist of six variables  with a pair of characters in the Hex code. Hex code is representing the intensity of red, green, and blue in the color respectively.
HTML color codes used in websites and other software applications.

Format of Hex Color Codes

Now We are trying to understand that how format of Hex Color Codes does work. Hex is a 6-digit, 24 bit, hexidecimal number that represents Red, Green, and Blue. Six digit hex codes can be prefixed by the symbol '#' in HTML color codes.

For example, Hex color code for white is #FFFFFF  and Hex color code for black is #000000

  1. The 1st and 2nd variable in Hex color code defines the intensity of red color.
  2. The 3rd and 4th variable defines the intensity of green.
  3. The 5th and 6th variable defines the intensity of blue.
  4. Most of color can be made by combining the intensities of red, green, and blue .

We can use above hex code formats as color codes in HTML.

List of some common HTML color codes

We provides list of HTML color codes as below.

HTML color codes
Color Name HTML color codes
Yellow #FFFF00
Red #FF0000
Green #008000
Blue #0000FF
Black #000000
White #FFFFFF
Gray #808080
Silver #C0C0C0

 

Example :

<div style="width:95%;">
<h3>List of HTML Color Codes</h3>
<?
$colors = array();
while (true) {
$color = substr(str_shuffle('ABCDEF0123456789'), 0, 6);
$colors[$color] = '#' . $color;
if (count($colors) == 100 ) {

foreach($colors as $key=>$hexcode){
echo "<span style='background-color:$hexcode;height:35px; width:15%;text-align:center;vertical-align:middle;font-weight:bold;display:table-cell;color:#FFFFFF;margin:5px;float:left;'>".$hexcode."</span>";
}
break;
}
}

?>
</div>

Output :

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

96874