Skip to content

Instantly share code, notes, and snippets.

@megclaypool
Last active May 18, 2018 15:30
Show Gist options
  • Save megclaypool/78e2a565ef17a5cac98cd7d6cdd2d632 to your computer and use it in GitHub Desktop.
Save megclaypool/78e2a565ef17a5cac98cd7d6cdd2d632 to your computer and use it in GitHub Desktop.
SCSS rbga() Function Awesome Sauce. The rgba function can take a color and an opacity as its arguments. You can plug in a variable(!) as the color, including colors defined using hex! This is excellent for buttons, since this means that you can bot
$blue: #4900ff;

.some_class {
  background-color: rgba($blue, 1);
  
  &:hover {
    background-color: rgba($blue, .5);
  }
}

Codepen example

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