You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
661 B
36 lines
661 B
9 years ago
|
var utils = require('../utils')
|
||
|
, nodes = require('../nodes')
|
||
|
, hsla = require('./hsla');
|
||
|
|
||
|
/**
|
||
|
* Convert the given `color` to an `HSLA` node,
|
||
|
* or h,s,l component values.
|
||
|
*
|
||
|
* Examples:
|
||
|
*
|
||
|
* hsl(10, 50, 30)
|
||
|
* // => HSLA
|
||
|
*
|
||
|
* hsl(#ffcc00)
|
||
|
* // => HSLA
|
||
|
*
|
||
|
* @param {Unit|HSLA|RGBA} hue
|
||
|
* @param {Unit} saturation
|
||
|
* @param {Unit} lightness
|
||
|
* @return {HSLA}
|
||
|
* @api public
|
||
|
*/
|
||
|
|
||
|
module.exports = function hsl(hue, saturation, lightness){
|
||
|
if (1 == arguments.length) {
|
||
|
utils.assertColor(hue, 'color');
|
||
|
return hue.hsla;
|
||
|
} else {
|
||
|
return hsla(
|
||
|
hue
|
||
|
, saturation
|
||
|
, lightness
|
||
|
, new nodes.Unit(1));
|
||
|
}
|
||
|
};
|