CSS Theory - Color Systems(Hexadecimal, RGBA)
Notice! *These posts are basically my learning notes.*
There can misinformation and mistakes :(
If you find any wrong info, please leave a comment and I will get to it asap!
Hexadecimal system
- Hexadecimal system is a coloring system that has 6 digits followed by
#
to represent a color#3da56e
RGBA
- RGBA uses Red, Green and Blue from 0 to 255 to represent color
- You can also add opacity to RGBA color
rgb(61, 165, 110)
This is without opacityrgba(61, 165, 110, 0.5)
This is with 50% opacity
How to utilize colors as variable
- If you are using same color in many different elements, you can save the color as variable in CSS
:root {
—main-color: #3da56e;
}
div {
background-color: var(—main-color);
}
span {
color: var(—main-color);
}
- Other things can be saved in the
:root
as variable and this will save a lot of time
Leave a comment