HTML Colors

What is Color?

Colour, also spelled Color is the visual perceptual property deriving from the spectrum of light interacting with the photoreceptor cells of the eyes. To see color, you have to have light . When light shines on an object some colors bounce off the object and others are absorbed by it. Your eyes only see the colors that are bounced off or reflected.


colors

There are three different types of colors:

  1. Primary Colors
  2. Secondary Colors
  3. Tertiary Colors
  1. Primary Colors: These are the 3 pigment colors that can not be mixed or formed by any combination of other colors. All other colors are derived from these 3 hues.

Primary colors
  1. Secondary Colors: These are the colors formed by mixing the primary colors.

Secondary Colors
  1. Tertiary Colors: These are the colors formed by mixing a primary and a secondary color. That's why the hue is a two word name, such as blue-green, red-violet, and yellow-orange.

Tertiary Colors

Colour has three properties:

  1. Hue: Hue is the name of a colour, such as red, blue, or yellow.
  2. Value: Value is the lightness or darkness of a hue (colour).
  3. Intensity: Intensity is the brightness or dullness of a hue (colour).

Color Code

A color code is a system for displaying information by using different colors. There are various ways to represent these colors. While adding colors to any element on the html page, we use these color codes.

Formats used for color codes in HTML are:

  1. Hexadecimal Color Code
  2. RGB Values
  3. HSV Values
  4. Color Name

Hexadecimal Color Code

A Hexadecimal Color Code is a way of specifying color using hexadecimal values. It is simply a way to define the amounts of red , green and blue that make up the colors and hues you want.

A computer can display millions of different colors, and remembering the names of every single one of them is impossible. The Hexadecimal Color Code, often referred to simply as a hex code, is an easy way to specify colors on the web. Hexa means six and decimal means ten, which stands for the base 16 number system. Hexadecimal numbers start with a hashtag (#), and are followed by six letters or numbers (e.g. #00FF00). The first two digits refer to red, the next two to green, and the last two are blue(#RRGGBB). You'll define how much red, green, and blue in values between 00 and FF instead of 0 to 255 like in RGB.


What is Hexadecimal Color Code?

Zero (0) is the smallest representations of a color . It's almost the total absence of color. F is 15 times the intensity of the color of 0. Combinations of these digits create different shades of a particular color. Double Zero, "00," is equal to zero hue. FF is equal to a pure color. You may have seen hex codes like #FFF, #000, #0F0 or even #ABC that only use three digits. This is just a shorthand of writing a code which is three pairs of identical digits: #FFFFFF, #000000, #00FF00 or #AABBCC.

Hexadecimal Color Code examples:

How to change html body background color?


html-hexadecimal-color-code

How to change CSS body background color?


css-hexadecimal-color-code

RGB Values

The three primary colors are red, blue, and yellow. Red, green, and blue can be combined in various proportions to obtain any color in the visible spectrum. If you mix all the colors together on a computer monitor, you get white instead of black. That is because the colors are additive and referred to as "RGB". The values for each of these components can range from 0 to 255, giving us a total of 256 shades for each component. When we multiply these shades together we get a total of 256x256x256 = 16,777,216 colors to choose from.

RGB color values are supported in all browsers . It is very simple to specify a color in RGB terms. For example, say we wanted to display all paragraphs with a Red component of 255, a Green component of 127, and a Blue component of 80 (giving a coral color). We would simply use the following style declaration:


What is RGB Color Code?

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

HSV (Hue, Saturation, Value)

What is HSV Color Code?

HSV is so named for three values: Hue , Saturation and Value . This color space describes colors (hue or tint) in terms of their shade (saturation or amount of gray) and their brightness value. Hue is more specifically described by the dominant wavelength and is the first item we refer to (i.e. "yellow") when adding in the three components of a color. Saturation defines the brilliance and intensity of a color and Value refers to the lightness or darkness of a color. The HSV representation models the way paints of different colors mix together, with the saturation dimension resembling various shades of brightly colored paint, and the value dimension resembling the mixture of those paints with varying amounts of black or white paint . With hue, their angular dimension, starting at the red primary at 0 ° , passing through the green primary at 120 ° and the blue primary at 240 ° , and then wrapping back red at 360 ° .

Color Name

Remembering the hex code for different colors may be difficult for the beginners. So you can simply add the color name to add colors to the element. HTML supports 140 color names. Some examples of color names are tomato, orange, green, blue, etc.

<br><p style="background-color: aqua">Aqua </p>