Skip to content

Instantly share code, notes, and snippets.

@karlstolley
Created October 19, 2012 03:04
Show Gist options
  • Save karlstolley/3916003 to your computer and use it in GitHub Desktop.
Save karlstolley/3916003 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;
}
@gricelsepulveda
Copy link

thanks!

@M-Fasciano
Copy link

Nice!!

@MarcosTeles
Copy link

Nice!

@jamesbarrett95
Copy link

Thanks

@luisramirezdev
Copy link

Thanks!

@Rubenxfd
Copy link

Rubenxfd commented Feb 7, 2018

Thanks!

@dsavai
Copy link

dsavai commented Feb 8, 2018

NIce

@174n
Copy link

174n commented Mar 17, 2018

thanks

Copy link

ghost commented Mar 27, 2018

helpful

@DantonGodoy
Copy link

Thanks bro!

@alpanjel
Copy link

thanks

@willdow
Copy link

willdow commented Jan 24, 2019

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment