Public functions exported by @nuvoui/core: tokens, colours, breakpoints, maths, strings and units. Call them in your own SCSS, such as color: token(text-muted).
This page is generated from the doc blocks in the core source when the site is built, so it always matches the current release of @nuvoui/core. Every example is compiled against core during the build; open Compiled CSS under an example to see its output. The A to Z index lists every public mixin and function.
Resolves a breakpoint name from $breakpoints to its width; a length passes through, and a unitless number that is not a breakpoint name or an unknown name raises an error.
@functionget-breakpoint-value($bp, $debug:false)
Parameter
Type
Default
Description
$bp
String|Number
Required
Breakpoint name (xs, sm, md, lg, xl, 2xl; quoting 2xl is optional) or a length such as 800px
Returns the OKLCH shade scale (50 to 950) of a colour value, precomputed for the default role and palette colours and generated for any other; the value is shaded directly and never re-read as a palette name, so "blue" is CSS blue.
@functioncreate-color-scale($color)
Parameter
Type
Default
Description
$color
Color|String
Required
Colour value or colour string (#007bff, blue, rgb())
Returns
MapStop to colour map with keys 50, 100 to 900 and 950
Returns a real colour value for Sass maths from a role, palette name or colour value at a shade stop; role and palette names win over CSS named colours, and var() or an invalid stop raises an error.
@functionget-color($color, $shade:500)
Parameter
Type
Default
Description
$color
String|Color
Required
Role (brand, danger), palette hue (red, blue, gray) or colour value
$shade
Number
500
Shade stop: 50, 100 to 900, or 950
Returns
ColorThe shaded colour (not a var() reference, so it does not follow the theme)
Picks whichever of two text colours has the higher WCAG contrast against the background, by default the light theme text-regular and text-inverted; a transparent background raises an error.
Whether utility classes for a feature are generated: requires $generate-utility-classes and a feature flag that is on (a feature missing from $feature-flags counts as on).
@functionfeature-enabled($feature)
Parameter
Type
Default
Description
$feature
String
Required
Feature flag name (position, spacing, theme, ...)
Returns
BooleanTrue when the feature's utility classes are generated
Parses the leading number of a string and returns it with the remaining text; a string that does not start with a number gives null.
@functionto-number-raw($value)
Parameter
Type
Default
Description
$value
Number|String
Required
Number or string to parse
Returns
List|NullA (number, rest) pair, for example (12, "px")
Example
@use"sass:list";
$parsed: to-number-raw("12px");
.card {
z-index: list.nth($parsed, 1);
}
Compiled CSS
.card {
z-index: 12;
}
Source: functions/_math.scss:99
to-number()function
Converts a string to a number, keeping a trailing CSS unit as a real unit ("12px" gives 12px) or applying $append-unit; other trailing text is dropped and a non-numeric string gives null.
@functionto-number($value, $append-unit:null)
Parameter
Type
Default
Description
$value
Number|String
Required
Number or string to convert
$append-unit
String|Number
null
Unit name or unit number (rem, 1rem) applied to the parsed number, replacing any trailing text
Returns
Number|NullThe number, or null when the string is not numeric
Classifies a value as null, color, number, boolean, list, map, css-var, state, breakpoint, font-weight, border-radius, css-keyword, css-function or string.