html colors

HTML Colors are most important to the web pages for a good look and feel for the websites. The user can visit the website to know the information of the company or an organization.

HTML colors can be set to <body> tag of the webpage. The colors can also be set to the body background and the text. We can use different color formats for the body and the text.

HTML Colors

Following are a list of color formats:

  • HTML Color Names
  • RGB Color Code
  • HEX Color Code
  • HSL Color Code
  • RGBA and HSLA color codes

HTML Color Names:

    HTML Color can be specified by using a color name in the HTML. You can set the colors to the background of the page, text, and border. Examples of HTML Colors are Red, Green, Blue, Yellow, Orange, Black, etc.
Red Green Blue Aqua
Tan Black Purple Orange

Example:

<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Color Names</title>
</head>
<body>
<h1>HTML Color Names</h1>
<p style="background-color:black;">Background of my text color</p>
<body>

HTML RGB Color Code

    HTML Color can be specified by using RGB value, using a formula: RGB (red, green, blue) RGB parameters define the intensity of the color value range between ‘0 to 255’.

For Example:

If you want to display the color value for the RED in the RGB parameters, use RGB(255,0,0). The highest value in the RGB parameters ‘255’ displays the red color, and the value ‘0’ displays the color “green and blue.” Another example for displaying the color value for GREEN in the RGB parameters, RGB(0, 255, 0) and the value ‘0’ has set for the color “red and blue.” If you want to display the black color in the RGB parameters, set the color value ‘0’ ex: RGB(0, 0, 0). To display white color in the RGB parameters, set the color value to ‘255’. ex: RGB(255, 255, 255).


HTML HEX Color Code

    HTML Color can be specified by using HEX Color Code. HEX stands for hexadecimal. The hexadecimal color value can also be specified in the form of #rrggbb. Here, “RR stands for Red, GG stands for Green, BB stands for Blue,” Hexadecimal value range between ’00 to ff’.

For Example:

If you want to display red color for the background of the page, text, border in the hexadecimal, the value is “#ff0000”. Here, (ff) specifies the red, and (00) specifies the green and blue. Another example, If you want to display green (or) blue color for the background of the page, text, border in the hexadecimal value is “#00ff00” and “#0000ff”. Here, (ff) is the highest value set for green and blue.


HTML HSL Color Code

    HTML Color can be specified by using HSL Color Code. HSL Stands for Hue, Saturation, and Lightness. The HSL Color value can be specified in the degree from 0 to 360. Saturation and Lightness both values display in the Percentages.

For Example:

Here, we will discuss about the Hue, Saturation, and Lightness:Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue. Saturation is a percentage value, 0% means a shade of gray, and 100% is the full color. Lightness is also a percentage value, 0% is black, and 100% is white.


Next Topic: HTML CSS