Less Color Definition Functions
Less supports a lot number of color functions to alter and manipulate colors in different ways.
A list of color definition functions supported in Less are given in the following table.
Index |
Function |
Description |
Example |
1) |
rgb: (red, green, blue) |
rgb creates color from red, green and blue values. it supports three parameters. red: it contains integer between 0 - 255 or percentage between 0 - 100%. green: it contains integer between 0 - 255 or percentage between 0 - 100%. blue: it contains integer between 0 - 255 or percentage between 0 - 100%. td>
| rgb(220,20,60): it converts color with rgb values as: #dc143c |
2) |
rgba: (red,green, green, alpha) |
rgba: rgba is used to determine color from red, green, blue and alpha values. it has following parameters: red: it contains integer between 0 - 255 or percentage between 0 - 100%. green: it contains integer between 0 - 255 or percentage between 0 - 100%. green: it contains integer between 0 - 255 or percentage between 0 - 100%. alpha: it contains number between 0 - 1 or percentage between 0 - 100%. > |
rgba(220,20,60, 0.5): it converts color object with rgba values as: rgba(220, 20, 60, 0.5) |
3) |
argb: (color) |
argb: it is used to define hex representation of color in #aarrggbb format. It uses below parameter: color: it specifies color object. |
argb(rgba(176,23,31,0.5)): it returns the argb color as: #80b0171f |
4) |
hsl: (hue, saturation,<div>lightness) |
hsl: It is used to generate the color from hue, saturation and lightness values. It has following parameters: hue: it contains integer between 0 - 360 which represents degrees. saturation: it contains number between 0 - 1 or percentage between 0 - 100%. lightness: it contains number between 0 - 1 or percentage between 0 - 100%. |
hsl(120,100%, 50%): it returns the color object using hsl values as: #00ff00 |
5) |
hsla: (hue, saturation, lightness, alpha) |
hsla: it is used to generate the color from hue, saturation, lightness and alpha values. it has following parameters: hue: it contains integer between 0 - 360 which represents degrees. saturation: it contains number between 0 - 1 or percentage between 0 - 100%. lightness: it contains number between 0 - 1 or percentage between 0 - 100%. alpha: it contains number between 0 - 1 or percentage between 0 - 100%. |
hsla(0,100%,50%,0.5): it specifies the color object using hsla values as: rgba(255, 0, 0, 0.5); |
6) |
hsv: (hue, saturation, value) |
hsv: it is used to produce the color from hue, saturation and value values. It contains following parameters: hue: it contains integer between 0 - 360 which represents degrees. saturation: it contains number between 0 - 1 or percentage between 0 - 100%. value: it contains number between 0 - 1 or percentage between 0 - 100%. |
hsv(80,90%,70%): it converts color object with hsv values as: #7db312 |
7) |
hsva: (hue, saturation, value, alpha) |
hsva: it is used to produce the color from hue, saturation, value and alpha values. it uses following parameters: hue: it contains integer between 0 - 360 which represents degrees. saturation: it contains number between 0 - 1 or percentage between 0 ? 100%. value: it contains number between 0 - 1 or percentage between 0 - 100%. alpha: it contains number between 0 - 1 or percentage between 0 - 100%. |
hsva(80,90%,70%,0.6): it specifies color object with hsva values as: rgba(125, 179, 18, 0.6) |
|