Less function reference Beta 1.4.0
Less reference for personal information.
These functions are only available in the 1.4.0 beta (recorded here for personal reference if the main site disappears).escape(@string); // URL encodes a string
e(@string); // escape string content
%(@string, values...); // formats a string
unit(@dimension, [@unit: ""]); // remove or change the unit of a dimension
color(@string); // parses a string to a color
data-uri([mimetype,] url); // * inlines a resource and falls back to url()
ceil(@number); // rounds up to an integer
floor(@number); // rounds down to an integer
percentage(@number); // converts to a %, e.g. 0.5 -> 50%
round(number, [places: 0]); // rounds a number to a number of places
sqrt(number); // * calculates square root of a number
abs(number); // * absolute value of a number
sin(number); // * sine function
asin(number); // * arcsine - inverse of sine function
cos(number); // * cosine function
acos(number); // * arccosine - inverse of cosine function
tan(number); // * tangent function
atan(number); // * arctangent - inverse of tangent function
pi(); // * returns pi
pow(@base, @exponent); // * first argument raised to the power of the second argument
mod(number, number); // * first argument modulus second argument
convert(number, units); // * converts between number types
unit(number, units); // *changes number units without converting it
color(string); // converts string or escaped value into color
rgb(@r, @g, @b); // converts to a color
rgba(@r, @g, @b, @a); // converts to a color
argb(@color); // creates a #AARRGGBB
hsl(@hue, @saturation, @lightness); // creates a color
hsla(@hue, @saturation, @lightness, @alpha); // creates a color
hsv(@hue, @saturation, @value); // creates a color
hsva(@hue, @saturation, @value, @alpha); // creates a color
hue(@color); // returns the `hue` channel of @color in the HSL space
saturation(@color); // returns the `saturation` channel of @color in the HSL space
lightness(@color); // returns the 'lightness' channel of @color in the HSL space
hsvhue(@color); // * returns the `hue` channel of @color in the HSV space
hsvsaturation(@color); // * returns the `saturation` channel of @color in the HSV space
hsvvalue(@color); // * returns the 'value' channel of @color in the HSV space
red(@color); // returns the 'red' channel of @color
green(@color); // returns the 'green' channel of @color
blue(@color); // returns the 'blue' channel of @color
alpha(@color); // returns the 'alpha' channel of @color
luma(@color); // returns the 'luma' value (perceptual brightness) of @color
saturate(@color, 10%); // return a color 10% points *more* saturated
desaturate(@color, 10%); // return a color 10% points *less* saturated
lighten(@color, 10%); // return a color 10% points *lighter*
darken(@color, 10%); // return a color 10% points *darker*
fadein(@color, 10%); // return a color 10% points *less* transparent
fadeout(@color, 10%); // return a color 10% points *more* transparent
fade(@color, 50%); // return @color with 50% transparency
spin(@color, 10); // return a color with a 10 degree larger in hue
mix(@color1, @color2, [@weight: 50%]); // return a mix of @color1 and @color2
greyscale(@color); // returns a grey, 100% desaturated color
contrast(@color1, [@darkcolor: black], [@lightcolor: white], [@threshold: 43%]);
// return @darkcolor if @color1 is > 43% luma
// otherwise return @lightcolor, see notes
multiply(@color1, @color2);
screen(@color1, @color2);
overlay(@color1, @color2);
softlight(@color1, @color2);
hardlight(@color1, @color2);
difference(@color1, @color2);
exclusion(@color1, @color2);
average(@color1, @color2);
negation(@color1, @color2);
iscolor(@colorOrAnything); // returns true if passed a color, including keyword colors
isnumber(@numberOrAnything); // returns true if a number of any unit
isstring(@stringOrAnything); // returns true if it is passed a string
iskeyword(@keywordOrAnything); // returns true if it is passed keyword
isurl(@urlOrAnything); // returns true if it is a string and a url
ispixel(@pixelOrAnything); // returns true if it is a number and a px
ispercentage(@percentageOrAnything); // returns true if it is a number and a %
isem(@emOrAnything); // returns true if it is a number and an em
isunit(@numberOrAnything, "rem"); // * returns if a parameter is a number and is in a particular unit
// * These functions are only available in the 1.4.0 beta