What is CSS2 Color code & names

Any color can be made by mixing these three colors together. The function accepts 3 comma-separated values that are either integers between 0 and 255, or percentages. For example, rgb(255,0,0) and rgb (100%,0%0%) both correspond to red. The values between 0 and 255 for each color correspond to the hexadecimal values of these colors.

RGB Hex Notation

#789abc

RGB color values are supported in all browesers.

An RGB color value is specified with: rgb(red,green,blue).

Each parameter (red,green,and blue) defomes the intensity of the color as an integer between 0 and 255.

For example, rgb(0,0, 255) is rendered as blue, because the blue parameter is set to its highest value (255) and the others are set to 0.

Example

<style>
 div {
    background-color: rgb(0, 191, 255);
    color: rgb(255, 255, 255);
}
</style>

Hexadecimal Colors

Hexadecimal color values are also supported in all browsers.

A hexadecimal color is specified with: #RRGGBB.

RR(red), GG(green) and BB (blue) are hexadecimal integers between 00 and FF specifying intensity of the color.

For example, #0000FF is displayed as blue, because the blue component is set to its highest value (FF) and the others are set to 00.

Example

<style>

div {

background-color: #00bfff;

color: #fffff;

}

</style>

Equates to “#aaccff”

#acf

The hexadecimal color code #aaccff / #acf is a light shade of cyan-blue. In the RGB color model #aaccff is comprised of 66.67% red, 80% green and 100% blue. In the HSL color space #aaccff has a hue of 216°  (degress), 100% saturation and 83% lightness. This color has an approximate wavelength of 476.92 nm.

rgb(0,-25,50)

Value of each of red, green and blue. 0 to 255, may be swapped for percentages.

An RGB color value is specified with: rgb(red, green, blue).

Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 50.

Example

<style>
 div {
  background-color: rgb(0,25,50);
  color: rgb (50,50,50);
}
</style>


Leave a Reply

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