Created
April 3, 2016 05:45
-
-
Save lachlanjc/b7fa7a307e2646baf0e5b1ee312331c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------- | |
// Size function | |
// ============= | |
// The size function returns a measurement determined by | |
// the (required) argument of level. | |
// | |
// Example: size(5); | |
// This will return 16rem. | |
//--------------------------- | |
$__size-default: 2; | |
$__size-unit: 1rem; | |
@function size($level: 1) { | |
@if $level <= 8 { | |
$value: $level; | |
@if $level == 1 { | |
$value: half($__size-default); | |
} @else { | |
$value: power($__size-default, ($level + 1)); | |
} | |
@return ($value * $__size-unit); | |
} @else { | |
@warn "Size ranges from 1–8. You provided #{level}." | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment