CSS Color
CSS Color:
colors can be defined whichever way one see fit.
Keyword Colors:
'RGB values' denote specific color names, for instance, red, green, blue, etc, but not every color.
p {
color: red;
background-color: lightblue;
}
Hexadecimal Colors:
Hexadecimal values signify colors and for instance, #RRGGBB represents red, green and blue respectively where RR, GG, and BB are two-digit hexadecimal values for red, green and blue.
p {
color: #ff0000; /* red */
background-color: #00ff00; /* green */
}
RGB Colors:
An RGB mode, standing for Red, Green, Blue, uses 0 to 255 numbers for each color's intensity.
p {
color: rgb(255, 0, 0); /* red */
background-color: rgb(0, 255, 0); /* green */
}
RGBA Colors:
Similar to RGB, but, instead, the numeral alpha is included for transparency and specified as a value between 0 an 1.
p {
color: rgba(255, 0, 0, 0.5); /* semi-transparent red */
background-color: rgba(0, 255, 0, 0.7); /* semi-transparent green */
}
HSL and HSLA Colors:
A model like HSL consists of three elements, which are Hue, Saturation, and Lightness. Hue is given a number between 0 and 360 accordingly.
HSLA is pretty much like an alternative of HSL, with an alpha channel for transparency effects.
p {
color: hsl(0, 100%, 50%); /* red */
background-color: hsla(120, 100%, 50%, 0.3); /* semi-transparent green */
}
These are both just a few of the various ways to indicate colors on in CSS.
Go for the technique your goal may be or the design of your project!