Skip to content

Instantly share code, notes, and snippets.

@ierhyna
Created October 29, 2015 12:45
Show Gist options
  • Save ierhyna/a3da0e03ffcf534a644e to your computer and use it in GitHub Desktop.
Save ierhyna/a3da0e03ffcf534a644e to your computer and use it in GitHub Desktop.
Basic Sass Functions
//
// Color Functions
//
// Get color
// Use: $button-color: color('primary');
@function color($key: 'primary') {
@return map-get($colors, $key);
}
// Generate opacity
// Use: $button-transparent-color: color-alpha('primary', 'light');
// => rgba(#8e3329, 0.8)
@function color-alpha($name: 'primary', $opacity: 0) {
$color: color($name);
$opacity: map-get($color-opacity, $opacity);
@return rgba($color, $opacity);
}
//
// Text Functions
//
// Using type-scale values
@function type-scale($level) {
@return map-get($type-scale, $level);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment