Members
(static) color
Transforms numbers into hex values and leaves strings as they are.
This transformer is used in color related core functions.
Example
const hexValue = color(000)
const stringValue = color('DarkSlateBlue')
hexValue === '#000'
stringValue === 'DarkSlateBlue'
(static) construct
Constructs an array for a given value and CSS property.
The array is made up of strings and numbers, depending on the transformer. This function is an abstraction to be used for functions representing CSS properties.
- Default Value:
- px
- Source:
(static) core
Universal function to create core functions.
Returns a function that takes a fallback value and returns a function which
takes an object containing a theme property and a specified property. This
function returns an array based on the fallback value or the specified
property. This function also has properties propName and p of type function, which
takes a string and returns the same function but with the specified property
being the string that was passed.
- Source:
(static) degrees
Transforms numbers into degrees and leaves strings as they are.
Examples
const degrees = degrees(10) // 10deg
const degrees = degrees(360) // 360deg
(static) get
Gets a value from an object based on a string path.
- Source:
(static) percent
Transforms numbers into percentages and leaves strings as they are.
Numbers below 1 are multiplied by 100.
Examples
const percentage = percent(0.5) // 50%
const percentage = percent(50) // 50%
(static) plain
Transforms numbers into hex values and leaves strings as they are.
This transformer is used in core functions that take special values.
Example
const numberValue = plain(3)
const stringValue = plain('1 / 3')
numberValue === 3
stringValue === '1 / 3'
(static) propless
Universal function to create propless functions.
Returns a function that takes a value and returns a function which
takes an object containing a theme property. This function returns an array
based on the value.
- Source:
(static) px
Transforms numbers into px values and leaves strings as they are.
This is the default transformer for the
construct
function.
Example
const pxValue = px(100)
const stringValue = px('1rem')
pxValue === '100px'
stringValue === '1rem'