source: trip-planner-front/node_modules/stylus/lib/functions/rgb.js@ e29cc2e

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

initial commit

  • Property mode set to 100644
File size: 759 bytes
Line 
1var utils = require('../utils')
2 , nodes = require('../nodes')
3 , rgba = require('./rgba');
4
5/**
6 * Return a `RGBA` from the r,g,b channels.
7 *
8 * Examples:
9 *
10 * rgb(255,204,0)
11 * // => #ffcc00
12 *
13 * rgb(#fff)
14 * // => #fff
15 *
16 * @param {Unit|RGBA|HSLA} red
17 * @param {Unit} green
18 * @param {Unit} blue
19 * @return {RGBA}
20 * @api public
21 */
22
23function rgb(red, green, blue){
24 switch (arguments.length) {
25 case 1:
26 utils.assertColor(red);
27 var color = red.rgba;
28 return new nodes.RGBA(
29 color.r
30 , color.g
31 , color.b
32 , 1);
33 default:
34 return rgba(
35 red
36 , green
37 , blue
38 , new nodes.Unit(1));
39 }
40}
41rgb.params = ['red', 'green', 'blue'];
42module.exports = rgb;
Note: See TracBrowser for help on using the repository browser.