Skip to content

Instantly share code, notes, and snippets.

@udoyen
Forked from karlstolley/rgba.scss
Created March 10, 2018 21:44
Show Gist options
  • Select an option

  • Save udoyen/c380f51edcc3a50fb56afd8da540a11f to your computer and use it in GitHub Desktop.

Select an option

Save udoyen/c380f51edcc3a50fb56afd8da540a11f to your computer and use it in GitHub Desktop.
RGB/RGBa in Sass
// Declare the color as RGB; SASS will treat this as hex
$green: rgb(27,224,63);
// Declare an alpha
$alpha: .5;
// Declare another color variable as a color with an alpha
$greenAlpha: rgba($green, $alpha);
body {
/* As RGB (which SASS actually ouputs as HEX) */
background: $green;
/* With RGBa syntax */
background: rgba($green, $alpha);
/* Or as a simple variable with RGBa */
background: $greenAlpha;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment