Sha256: 2e0a4b7acfd32afc668bc87a79bc5868e74ba42cde8ed536c077bf4aee7bdbfb

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

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

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

	// Extend default 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");

	// Build the scale.
	$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 smaller values to the scale.
	@for $i from -$numb-smaller-values through -1 {
		$size: $base-value * power($scaling-ratio, $i);
		$scale: append($scale, $size);
	}

	// Add the base value to the scale.
	$scale: append($scale, $base-value);

	// Calculate and add larger values to the scale.
	@for $i from 1 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.8 stylesheets/type-director/_build-scale.scss