Color values (HEX, RGBA, color names)

Lesson info

Lesson info

Sometimes, using Webflow's color picker is all you need to choose a color to work with. But if you need precision, you want to get more specific by using a color name, hex code, or RGBA value. In this video, we'll explain all three options and how to use them in Webflow.

Clone this projectDownload project assetsDownload lesson assets

Transcript

Using a color picker can be helpful, and sometimes it's all we need. But for precision, we often want to get more specific.

And there are three common ways that colors are represented on the web. We have color names, hex codes (or hex triplets), and RGBA.

Let's start with names. These are the common color names for 140 colors that are supported by modern browsers. For instance, sometimes we see 1E90FF, which might be more challenging to remember than DodgerBlue. So if we type in DodgerBlue, we're all set. But the names and the colors are somewhat arbitrary, like LawnGreen, PeachPuff, BlanchedAlmond, and of course, LemonChiffon.

Because these presets—because HTML color names aren’t a full representation of what's entirely possible with web colors, sometimes it can be a bit more freeing to use one of the other formats. With that being said...

We have hex codes. And these are usually six-digit codes that correspond with a precise color output. And the reason they're also called hex triplets is because there are three sets of two digits. Red, green, and blue. The same three colors that make up each pixel in a display.

As you increase the value of a particular color? The more of that color you get in your output. Set all values to zero? We got black. Ramp up the red? We got red. And if we add blue, we approach magenta. Add in some green, now we have full white. You can play with the red, and the green, and the blue to get virtually any color you can think of.

The hex part of this is pretty simple if you're a fan of counting. In traditional counting, base-10, we count 0 through 9 in the ones place. Then we switch the tens place to a 1, counting 0 through 9 again. We repeat each time we pass 9.

When we count hexidecimally, which is not a real word, we just add the letters A through F after our nines. That's it. Before we switch to 10, we're going to do A, B, C, D, E, F. Then, we switch the digit to the left after we count past F. We’re just adding A through F after our nines. Same thing in the tens place, when our numbers get large enough.

Sometimes designers and developers will use shorthand hex. On Google, the background attribute is FFF and the color attribute, which affects text color, is 222.

You can use shorthand hex—if you’re working with a color that has repeating digits in all three of the color values. Like AA-BB-CC or 44-11-EE. You can simply omit the second digit for each color, making it ABC or 41E.Now if hexadecimals aren’t your thing, you don’t need them. In fact, if you prefer to think numerically, you’re in luck, because RGBA uses good old-fashioned base-10. Normal numbers. What’s after 9? 10. What’s after 99? 100. What’s after six...

RGBA uses the values 0 through 255 to represent each color—that’s 256 levels of red if we include zero. Same control here as hex. Red, green, blue…and in this case, the A, of course, is for Alpha. This is incredible freedom right here when we’re setting colors. So we can control the opacity from completely transparent to fully opaque. The lower the alpha, the more transparent the color. The higher the alpha? The more opaque.

So. We have color names for some of our more specific colors like Chocolate and BurlyWood, we have hex codes or hex triplets, which let us specify red, green, and blue values hexidecimally, and RGBA: numerical control over each color and the ability to adjust opacity.