Stylament 0.23.2

Arithmetic

Mathematical Functions

These @functions represent well-known classes of mathematical functions. All parameters other than the first one define the concrete mathematical function, while the first parameter always is the argument to that function instance.

@function identity()

Identity function (f(x) = x).

Parameters & Return

$x: (Number)

The argument to the function.

@return (Number)

$x.

@function linear()

Linear function (f(x) = mx + n).

Parameters & Return

$x: (Number)

The argument to the function.

$slope: (Number)

The slope of the function (m).

$initial: 0 (Number)

The initial value (y-intercept) of the function (n).

@return (Number)

The function value at $x.

@function polynomial()

Polynomial function (f(x) = c₀ + c₁x + c₂x² + … = ∑cᵢxⁱ).

Parameters & Return

$x: (Number)

The argument to the function.

$coefficients: (List)

The coefficients of the polynomial.

@return (Number)

The function value at $x.

Used By

@mixin palette()

@function exponential()

Exponential function (f(x) = abˣ).

Parameters & Return

$exponent: (Number)

The exponent (x).

$base: (Number)

The base (b).

$coefficient: (Number)

The coefficient (a).

@return (Number)

The coefficient times the base to the power of the exponent (abˣ).

Configuration Functions

Functions for processing configuration.

@function -map-aliases() [private]

Translate a map of aliases to values from a dictionary. Each alias is asigned the value of the aliased dictionary key.

Parameters & Return

$aliases: (Map)

Map of aliases.

$dict: (Map)

Dictionary to look up values.

@return (Map)

Map with aliases pointing to looked up values.

Used By

@function map-config()

@function -apply-domain-range() [private]

Apply a range to a given domain. If the domain doesn’t cover the range it will be repeated, adding the current lap count to each domain value and as a prefix to each key. This implies that with no domain given, we can easily use the set of integers (ℤ) as default domain.

Parameters & Return

$base: (Map)

Map of aliases.

$range: (Map)

Range limiting the domain.

@return (Map)

The domain limited by the range.

Used By

@function map-function()

@function map-function()

Translate a map of domain arguments to their values of a given function.

Parameters & Return

$domain: null (Map)

The domain on which to apply the function.

$range: null (Map)

Range limiting the domain.

$func: null (Function)

Function to apply.

$params: null (Map)

Parameters to the function.

@return (Map)

Map with domain symbols pointing to their function values.

Requires

@function -apply-domain-range() [private]

@function call-conditional()

Used By

@function map-config()

@function map-config()

Translate a property configuration to a set of properties.

Parameters & Return

$conf: (Map)

Configuration map for this set of properties.

@return (Map)

A set of mapped, literal, and logical properties.

Requires

@function map-function()

@function -map-aliases() [private]

Geometry

Parametric Curves/Equations

Bézier Curves

Related

Wikipedia [external]

@function cubic()

Cubic Bézier curve, 1-dimensional.

Parameters & Return

$t: (Number)

The argument to the curve.

$p0: (Number)

First control point, P0.

$p1: (Number)

Second control point, P1.

$p2: (Number)

Third control point, P2.

$p3: (Number)

Fourth control point, P3.

@return (Number)

The curve value at $t.

Used By

@function cubic-2d()

@function cubic-2d()

Cubic Bézier curve, 2-dimensional.

Parameters & Return

$t: (Number)

The argument to the curve.

$x0: (Number)

Abscissa of first control point, P0.

$y0: (Number)

Ordinate of first control point, P0.

$x1: (Number)

Abscissa of second control point, P1.

$y1: (Number)

Ordinate of second control point, P1.

$x2: (Number)

Abscissa of third control point, P2.

$y2: (Number)

Ordinate of third control point, P2.

$x3: (Number)

Abscissa of fourth control point, P3.

$y3: (Number)

Ordinate of fourth control point, P3.

@return (Number)

The curve value at $t.

Requires

@function cubic()

Used By

@mixin palette()

Meta Functions

Functions for working with function objects.

@function call-conditional()

Call a function with one argument and with or without additional parameters.

Parameters & Return

$func: (Function)

Mapping function.

$arg: (Number)

The argument to the function.

$params: null (Map)

Parameters to the function.

@return (*)

The return value of the function call.

Used By

@function map-function()

Typography

Typographical Rhythm

@function rlh()

Derive root line-height (rlh).

Parameters & Return

$scale-base: (Number<rem|em|%>)

Base font-size of the typographical scale.

$line-root: (Number)

Relative line-height of the document root.

@return (Number<rem>)

Root line height. Absolute value mimicking the experimental CSS unit [rlh][mdn:rlh].

@function grid-line()

Baseline grid compatible line height at a given font size.

Parameters & Return

$em: (Number<rem|em|%>)

Font size to fit.

$rlh: (Number<rem>)

Root line height.

$min: (Number)

Minimum line height ratio.

$sub: (Number)

The number of line sub-divisions the grid allows.

@return (Number<rem|unitless>)

The minimum line height that fits the font size. For rem-based font sizes this is also in rem, otherwise a unit-less number.