Sha256: 80fce3ecc928b0b9f4ba807376c0cca6e7615452dc8eb0dbff1bf7fd9be2b1de
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
// Create a modular font scale. // Returns a nested list of font-size and line-height values. @function ss-build-font-scale($opts: ()) { // Extend default opts $opts: map-merge(( "base-font-size": 16px, "base-line-height": 1.5, "max-font-size": 28px, "max-line-height": 1.35, "round-under": null, "numb-smaller-sizes": 1, "numb-larger-sizes": 4 ), $opts); // Create font-size and line-height scales $font-size-scale: ss-build-scale(( "base-value": map-get($opts, "base-font-size"), "max-value": map-get($opts, "max-font-size"), "numb-smaller-values": map-get($opts, "numb-smaller-sizes"), "numb-larger-values": map-get($opts, "numb-larger-sizes") )); $line-height-scale: ss-build-scale(( "base-value": map-get($opts, "base-line-height"), "max-value": map-get($opts, "max-line-height"), "numb-smaller-values": map-get($opts, "numb-smaller-sizes"), "numb-larger-values": map-get($opts, "numb-larger-sizes") )); $sizes: (); // Pair each size with the correponding font-size // and line-height, then add the size to the scale. @for $i from -(map-get($opts, "numb-smaller-sizes")) to map-get($opts, "numb-larger-sizes") + 1 { // Calculate array position in order to lookup sizes in lists. $arr-position: $i + map-get($opts, "numb-smaller-sizes") + 1; // Key for size $name-of-size: $i; // Values for size $values: ( font-size: nth($font-size-scale, $arr-position), line-height: nth($line-height-scale, $arr-position) ); // Merge into $font-scale. $sizes: map-merge($sizes, ($name-of-size: $values)); } $font-scale: map-merge($opts, ("sizes": $sizes)); @return $font-scale; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sane-scale-0.6 | stylesheets/sane-scale/_build-font-scale.scss |