Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
715 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var utils = require('../utils')
|
---|
| 2 | , nodes = require('../nodes')
|
---|
| 3 | , hsla = require('./hsla');
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Convert the given `color` to an `HSLA` node,
|
---|
| 7 | * or h,s,l component values.
|
---|
| 8 | *
|
---|
| 9 | * Examples:
|
---|
| 10 | *
|
---|
| 11 | * hsl(10, 50, 30)
|
---|
| 12 | * // => HSLA
|
---|
| 13 | *
|
---|
| 14 | * hsl(#ffcc00)
|
---|
| 15 | * // => HSLA
|
---|
| 16 | *
|
---|
| 17 | * @param {Unit|HSLA|RGBA} hue
|
---|
| 18 | * @param {Unit} saturation
|
---|
| 19 | * @param {Unit} lightness
|
---|
| 20 | * @return {HSLA}
|
---|
| 21 | * @api public
|
---|
| 22 | */
|
---|
| 23 |
|
---|
| 24 | function hsl(hue, saturation, lightness){
|
---|
| 25 | if (1 == arguments.length) {
|
---|
| 26 | utils.assertColor(hue, 'color');
|
---|
| 27 | return hue.hsla;
|
---|
| 28 | } else {
|
---|
| 29 | return hsla(
|
---|
| 30 | hue
|
---|
| 31 | , saturation
|
---|
| 32 | , lightness
|
---|
| 33 | , new nodes.Unit(1));
|
---|
| 34 | }
|
---|
| 35 | };
|
---|
| 36 | hsl.params = ['hue', 'saturation', 'lightness'];
|
---|
| 37 | module.exports = hsl;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.