Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Sass Basics (retired) Speeding up Workflow with Sass Creating a Color Palette

Does the Color Palette variables within Sass work with RGBA values or just the Hexadecimal?

Can this be used for the other coloring styles rather than just Hexadecimal?

1 Answer

Máté Végh
Máté Végh
25,607 Points

Yes, they do! In Sass you can specify your colors in almost any color value: HEX, RGB, RGBA, HSL, HSLA


$hex: #007FFF;
$rgb: rgb(0,127,255);
$rgba: rgba(0,127,255,.5);
$hsl: hsl(210,100%,50%);
$hsla: hsla(210,100%,50%,.5);

.element {
  color: $hex;
  color: $rgb;
  color: $rgba;
  color: $hsl;
  color: $hsla;


.element {
  color: #007FFF;
  color: #007fff;
  color: rgba(0, 127, 255, 0.5);
  color: #007fff;
  color: rgba(0, 127, 255, 0.5);

Try it out on www.sassmeister.com

Adnan Pozegić
Adnan Pozegić
12,789 Points

Also keep an eye on that pesky IE support, from the reference:

IE filters require all colors include the alpha layer, and be in the strict format of #AABBCCDD. You can more easily convert the color using the ie_hex_str function. For example:

$translucent-red: rgba(255, 0, 0, 0.5);
$green: #00ff00;
div {
  filter: progid:DXImageTransform.Microsoft.gradient(enabled='false', startColorstr='#{ie-hex-str($green)}', endColorstr='#{ie-hex-str($translucent-red)}');