Advertisement


Should I use Hex or RGBA when designing a website?


Question

I know this has appeared on StackOverflow already:

But I'd like to ask on here since we're probably all more technical with our color selection and might be using it in HEX, RGB, and CMYK. Personally, my preference for the last few years is to use RGBA. I just find it easier to remember. I know certain HEX codes (are they codes?) but I know a ton of RGB codes, and can make fairly good estimates at any color I might need.

The main argument I've seen is Copy and Paste one, vs three. Are there any other differences in the Color Profile?

Is there a reason most programmers still prefer the HEX format?

With modern print techniques what other caveats, if any, might a designer face if they go with HEX and then try to find a similar CMYK color?

2017/05/23
1
4
5/23/2017 12:40:00 PM

Accepted Answer

The browser doesn't really care which format the color is in, performance is negligible. As such, I'll focus on the decision's effects on the developer(s) and the use cases.

A lot of developers find HEX values easier to read than RGB or HSL. As such, I tend to use HEX so that the next developer working on the project may have an easier job, even slightly so. However, if the developers are more familiar with another type it's not a problem to use it.

One of few times that a specific color type is necessary is when changing the alpha level is required. This is because opacity changes stacking order. As such, when the alpha level needs to be something other than one, sometimes it's preferable to use HSLa or RGBa over the opacity property.

When it comes to animating colors, working in RGB or HSL is preferable over HEX simply because numbers are easier to edit dynamically. HSL is great for animations that go through the spectrum because the color is determined by one number - the hue - provided the saturation and lightness don't actually need to be changed.

Ultimately doesn't matter too much, provided it's not a special case. The most important thing is to keep consistent in the type being used each project as much a possible because it helps productivity.

2014/10/10
9
10/10/2014 9:33:00 PM