source: trip-planner-front/node_modules/stylus/lib/functions/blue.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 678 bytes
RevLine 
[6a3a178]1var 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
22function 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};
34blue.params = ['color', 'value'];
35module.exports = blue;
Note: See TracBrowser for help on using the repository browser.