Best color scheme for colors

I am using colors in CSS and there are multiple options like HEX, HSL, HSB, RGB etc., I wanna ask, which one is used by professionals and which is considered to be the best practice to use?
15 Replies
Rook
Rookā€¢11mo ago
hex and rgb are the most widely used
Hamza Naeem
Hamza Naeemā€¢11mo ago
what about HSL, is it better than HEX and RGB?
Wouter Schaap
Wouter Schaapā€¢11mo ago
Depends what you are doing. New spaces are OKLAB and OKLCH. Those are better for gradients and mixing colors.
Rook
Rookā€¢11mo ago
i wouldn't really say there is a better or worse one. like, if you are using a color wheel, hsl makes a lot of sense visually, but when coding stuff out most of the time you don't need anything like that
Wouter Schaap
Wouter Schaapā€¢11mo ago
Still if you are looking into the color space of CSS I would take a look at CSS Color Module Level 4.
Hamza Naeem
Hamza Naeemā€¢11mo ago
so which one I should use then?
Rook
Rookā€¢11mo ago
if you are just starting out you will probably want to use hex, since it is the most widely used. rgb and hex are different ways of conveying the same thing, so you could also go with that if you'd like you aren't tied down to just using one and ignoring all the others lol
Hamza Naeem
Hamza Naeemā€¢11mo ago
Thank you rook
Mannix
Mannixā€¢11mo ago
I find hsl the easiest to use you pick a hue and then play with saturation and lightness
Hamza Naeem
Hamza Naeemā€¢11mo ago
I finds it the same
Mannix
Mannixā€¢11mo ago
hex hsl and rbg are interchangeable so use the one you are most comfortable with šŸ™‚
Rook
Rookā€¢11mo ago
^^^ i agree that hsl is the most intuitive option for me
Joao
Joaoā€¢11mo ago
For those of us out of the loop... what exactly does "CSS Color Module Level 4" mean?
Wouter Schaap
Wouter Schaapā€¢11mo ago
So the CSS working group has been hard at work to update and improve the way colors are rendered on the web. The way it is currently used by many has been the way since the end of the 90's. Colors and encoding for it has come leaps and bounds in others fields, like graphic design, film, television, camera's, monitors. The RGB color range is quite a narrow band of colors a lot of new monitors are able to display. It's not necessarily my area of expertise, but i have been diving into this over the past few weeks. Needless to say, a lot has happened in recent years.
Joao
Joaoā€¢11mo ago
Indeed, these last couple of years it almost feels like whenever I turn around CSS gets a ton of new features.