Sha256: 8e0793e2c2cb519532be5b586cc44b312a6db324cbff1312c8f3dc2b19b9d75a

Contents?: true

Size: 712 Bytes

Versions: 39

Compression:

Stored size: 712 Bytes

Contents

var nodes = require('../nodes')
  , hsla = require('./hsla')
  , component = require('./component');

/**
 * Return the hue component of the given `color`,
 * or set the hue component to the optional second `value` argument.
 *
 * Examples:
 *
 *    hue(#00c)
 *    // => 240deg
 *
 *    hue(#00c, 90deg)
 *    // => #6c0
 *
 * @param {RGBA|HSLA} color
 * @param {Unit} [value]
 * @return {Unit|RGBA}
 * @api public
 */

module.exports = function hue(color, value){
  if (value) {
    var hslaColor = color.hsla;
    return hsla(
      value,
      new nodes.Unit(hslaColor.s),
      new nodes.Unit(hslaColor.l),
      new nodes.Unit(hslaColor.a)
    )
  }
  return component(color, new nodes.String('hue'));
};

Version data entries

39 entries across 20 versions & 2 rubygems

Version Path
ela-4.1.6 node_modules/stylus/lib/functions/hue.js
ela-4.1.6 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.5 node_modules/stylus/lib/functions/hue.js
ela-4.1.5 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.4 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.4 node_modules/stylus/lib/functions/hue.js
ela-4.1.3 node_modules/stylus/lib/functions/hue.js
ela-4.1.3 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.2 node_modules/stylus/lib/functions/hue.js
ela-4.1.2 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.1 node_modules/stylus/lib/functions/hue.js
ela-4.1.1 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.1.0 node_modules/stylus/lib/functions/hue.js
ela-4.1.0 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-4.0.0 node_modules/stylus/lib/functions/hue.js
ela-4.0.0 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-3.4.3 node_modules/stylus/lib/functions/hue.js
ela-3.4.3 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-3.4.2 node_modules/nib/node_modules/stylus/lib/functions/hue.js
ela-3.4.2 node_modules/stylus/lib/functions/hue.js