setSpacingCssVars
setSpacingCssVars(
base?,unit?):void
Defined in: aberdeen.ts:2123
Initializes cssVars[0] through cssVars[12] with an exponential spacing scale.
The scale is calculated as 2^(n-3) * base, providing values from 0.25 * base to 512 * base.
Parameters
Section titled “Parameters”number = 1
The base size for the spacing scale that will apply to cssVars[3]. Every step up the scale will double this, while every step down will halve it. Defaults to 1.
string = 'rem'
The CSS unit to use, like ‘rem’, ‘em’, or ‘px’. Defaults to ‘rem’.
Returns
Section titled “Returns”void
Example
Section titled “Example”import A from 'aberdeen';// Use default scale (0.25rem to 512rem)A.setSpacingCssVars();
// Use custom base sizeA.setSpacingCssVars(16, 'px'); // 4px to 8192px
// Use em unitsA.setSpacingCssVars(1, 'em'); // 0.25em to 512em
// Show the last generated spacing valuesA.onEach(A.cssVars, (value, key) => { A(`div #${key} → ${value}`)}, (value, key) => parseInt(key)); // Numeric sort