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:
678 bytes
|
Line | |
---|
1 | var nodes = require('../nodes')
|
---|
2 | , rgba = require('./rgba');
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Return the blue component of the given `color`,
|
---|
6 | * or set the blue component to the optional second `value` argument.
|
---|
7 | *
|
---|
8 | * Examples:
|
---|
9 | *
|
---|
10 | * blue(#00c)
|
---|
11 | * // => 204
|
---|
12 | *
|
---|
13 | * blue(#000, 255)
|
---|
14 | * // => #00f
|
---|
15 | *
|
---|
16 | * @param {RGBA|HSLA} color
|
---|
17 | * @param {Unit} [value]
|
---|
18 | * @return {Unit|RGBA}
|
---|
19 | * @api public
|
---|
20 | */
|
---|
21 |
|
---|
22 | function blue(color, value){
|
---|
23 | color = color.rgba;
|
---|
24 | if (value) {
|
---|
25 | return rgba(
|
---|
26 | new nodes.Unit(color.r),
|
---|
27 | new nodes.Unit(color.g),
|
---|
28 | value,
|
---|
29 | new nodes.Unit(color.a)
|
---|
30 | );
|
---|
31 | }
|
---|
32 | return new nodes.Unit(color.b, '');
|
---|
33 | };
|
---|
34 | blue.params = ['color', 'value'];
|
---|
35 | module.exports = blue;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.