-
Notifications
You must be signed in to change notification settings - Fork 0
Function reference
alpha(color, [amount])Returns or modifies the alpha of a color
blue(color, [amount])Returns or modifies the blue component of a color.
Not supported by less.js
color(string)Converts a color string (e.g. “#33aaee”) to a color.
complement(color)Returns the complement of a color.
Not supported by less.js
contrast(color, [light=white], [dark=black], [threshold=0.5])Returns either `light` or `dark` , depending on the lightness of `color`.
Not supported by less.js
darken(color, amount)Modifies the brightness of a color (negative – see lighten).
desaturate(color, amount)Modifies the saturation of a color (negative – see saturate).
grayscale(color)
greyscale(color)Converts a color to grayscale.
grayscale not supported by less.js
green(color, [amount])Returns or modifies the green component of a color.
Not supported by less.js
hsl(hue, saturation, lightness)Returns a color with the specified hue, saturation and lightness components
hsla(hue, saturation, lightness, alpha)Returns a color with the specified hue, saturation, lightness and alpha components
hue(color, [amount])Returns or modifies the hue of a color.
Modifying the hue is not supported by less.js
lighten(color, amount)Modifies the brightness of a color (positive – see darken).
lightness(color, [amount])Returns or modifies the brightness of a color.
Modifying the hue is not supported by less.js
mix(color1, color2, [weight = 50%])Mix two colors together
red(color, [amount])Returns or modifies the red component of a color.
Not supported by less.js
rgb(red, green, blue)Returns a color with the specified red, green and blue components
rgba(r,g,b,a)(red, green, blue, alpha)Returns a color with the specified red, green, blue and alpha components
rgba(c,a)(color, alpha)Changes the alpha component of the specified color.
saturate(color, amount)Modifies the saturation of a color (positive – see desaturate).
saturation(color, [amount])Returns or modifies the saturation of a color.
Modifying is not supported by less.js
spin(color, amount)Modifies the hue of a color (same as hue).
Not supported by less.js
abs(number)returns the absolute of a number
Not supported by less.js
add(number1, [number2, [number3...]])Adds together all the parameters and returns the result.
ceil(number)Returns the ceiling of a number (e.g. 1.1 => 2)
floor(number)Returns the floor of a number (e.g. 1.8 => 1)
hex(number)Returns the hex version of a number. Note that the number will be clamped to one between 0 and 255.
increment(number)Adds 1 onto the number and returns it
percentage(number)Returns the number as a percentage. e.g. percentage(30%) => 30%, percentage(0.3) => 30%
pow(number, number)Calculates the power, e.g. pow(2,3) => 8
Not supported by less.js
round(number)Rounds the number, e.g. round(1.4) => 1, round(1.6) => 2
%(string, args...)Specify a string using C format identifiers, e.g. %d, %s, %a and the args will be filled into the placeholders.
Consider using string interpolation instead (e.g. “…@{variable}…”)
e(string)Removes the quotes from a string, e.g. e(“string”) => string
If the string is explicit, consider using ~ in front of the string to remove the quotes instead (e.g. ~“string” => string).
formatstring(string, args...)the equivalent of the C# format string. Consider using string interpolation.
iscolor(anything)returns true if the parameter is a color, otherwise it returns false
isem(anything)returns true if the parameter is in the em unit, otherwise it returns false
iskeyword(anything)returns true if the parameter is a color, otherwise it returns false
isnumber(anything)returns true if the parameter is a number, otherwise it returns false
ispercentage(anything)returns true if the parameter is in the % unit, otherwise it returns false
ispixel(anything)returns true if the parameter is in the px unit, otherwise it returns false
isstring(anything)returns true if the parameter is a string, otherwise it returns false
isurl(anything)returns true if the parameter is a url, otherwise it returns false