Skip to content

Instantly share code, notes, and snippets.

@ierhyna
Created October 29, 2015 12:45
Show Gist options
  • Select an option

  • Save ierhyna/a3da0e03ffcf534a644e to your computer and use it in GitHub Desktop.

Select an option

Save ierhyna/a3da0e03ffcf534a644e to your computer and use it in GitHub Desktop.

Revisions

  1. ierhyna created this gist Oct 29, 2015.
    30 changes: 30 additions & 0 deletions sass-functions.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    //
    // 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);
    }