Functions

A set of useful Sass functions

The OrbitCSS framework relies on several functions for compiling individual modules. You can use or extend these functions when making your themes.


calculateRem()

The calculateRem() function will convert the input pixel size to a rem value. Changing the $font-base variable will alter the result of this function.

calculateRem($size)
Copy

ParameterTypeDefaultDescription
$sizeintegernullThe pixel size you want to convert. This must be an integer and not in pixel units.

calculateEm()

The calculateEm() function will convert the input pixel size to a em value. Changing the $font-base variable will alter the result of this function.

calculateEm($size)
Copy

ParameterTypeDefaultDescription
$sizeintegernullThe pixel size you want to convert. This must be an integer and not in pixel units.

createColor()

The createColor() function takes a color as a parameter and returns a formatted color based on the value of the $color-type variable. Supported values are 'hsl', 'rgba' and 'hex'. This ensures consistency throughout the framework.

createColor($value)
Copy

ParameterTypeDefaultDescription
$valuecolornullA color string. This accepts color names, hex, rgba & hsl.

createHSLColor()

The createHSLColor() function accepts any CSS color value and returns the HSL equivalent.

createHSLColor($value);
Copy

ParameterTypeDefaultDescription
$valuecolornullA color string. This accepts color names, hex, rgba & hsl.

createRGBAColor()

The createRGBAColor() function accepts any CSS color value and returns the RGBA equivalent.

createRGBAColor($value);
Copy

ParameterTypeDefaultDescription
$valuecolornullA color string. This accepts color names, hex, rgba & hsl.

createHexColor()

The createHexColor() function accepts any CSS color value and returns the HEX equivalent.

createHexColor($value);
Copy

ParameterTypeDefaultDescription
$valuecolornullA color string. This accepts color names, hex, rgba & hsl.

getTextColor()

The getTextColor() function accepts a color value and will return either black or white from the color palette depending on the lightness of the input color. The purpose of this function is to always return a text color value that will be readable over the input color.

getTextColor($color)
Copy

ParameterTypeDefaultDescription
$colorcolornullThe background color you want to convert. Using hex values will yield the best results.

calcColWidth()

The calcColWidth($size) function takes an integer, multiplies it by the $col-percentage variable and returns the value. This is used to create size modifiers for the Grid module. The value of the $col-percentage variable is determined by the number of columns set in the $max-cols variable. The default is 12 max columns resulting in a column percentage of 8.3333.

calcColWidth($size)
Copy

ParameterTypeDefaultDescription
$sizeintegernullAn integer representing the number of colums you want.