Lightness: The lightness of the color can be defined as the light that we want to provide the color in which 0% represents black (there is no light), 50% represents neither dark nor light, and 100% represents white (full lightness). Saturation: It takes value in percentage in which 100% represents fully saturated, i.e., no shades of gray, 50% represent 50% gray, but the color is still visible, and 0% represents fully unsaturated, i.e., completely gray, and the color is invisible. 0 represents red, 120 represents green, 240 represents blue. Hue: It can be defined as the degree on the color wheel from 0 to 360. It is a short form of Hue, Saturation, and Lightness. In CSS, a color can be specified as an RGB value, using this formula: rgb(red, green, blue)Each parameter (red, green, and blue) defines the intensity of the color between 0 and 255. Some of the codes in short hex are #F00, #0F0, #0FF, #FF0, and many more. The black color notation in short hex is #000, and the white color notation in short hex is #FFF. It is a short form of hexadecimal notation in which every digit is recreated to arrive at an equivalent hexadecimal value.įor example, #7B6 becomes #77BB66 in hexadecimal.
This property is not supported in all browsers that's why it is not recommended to use it. This property allows three values that can either be in percentage or integer (range from 0 to 255). The color values in this format are specified by using the rgb() property. RGB format is the short form of ' RED GREEN and BLUE' that is used for defining the color of an HTML element simply by specifying the values of R, G, B that are in the range of 0 to 255. Let's understand the syntax and description of the above ways in detail.
We can define the color of an element by using the following ways: We can also use this property for the border-color and other decorative effects. In CSS, we use color values for specifying the color. Typically, this property is used to set the background color or the font color of an element. The color property in CSS is used to set the color of HTML elements.