Sha256: 068b88d0ed33b58c029b98239b16c7f81de8cb25cb234ed4add94ef641726a18

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

// Create a modular scale. Returns a list of values.

@function td-scale($opts: ()) {

	// Extend default opts with passed opts.
	$opts: map-merge((
		"base-value": 16px,
		"max-value": 28px,
		"numb-smaller-values": 1,
		"numb-larger-values": 4
	), $opts);

	$base-value: map-get($opts, "base-value");
	$max-value: map-get($opts, "max-value");
	$numb-larger-values: map-get($opts, "numb-larger-values");
	$numb-smaller-values: map-get($opts, "numb-smaller-values");

	// The object we'll return.
	$scale: ();

	// The ratio we'll use to calculate the missing sizes.
	$scaling-ratio: nth-root($max-value / $base-value, $numb-larger-values); 

	// Calculate and add values to the scale.
	@for $i from -$numb-smaller-values through $numb-larger-values {
		$size: $base-value * power($scaling-ratio, $i);
		$scale: append($scale, $size);
	}

	@return $scale;
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
type-director-0.9 stylesheets/type-director/_scale.scss