From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/stylus/lib/functions/hue.js | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 node_modules/stylus/lib/functions/hue.js (limited to 'node_modules/stylus/lib/functions/hue.js') diff --git a/node_modules/stylus/lib/functions/hue.js b/node_modules/stylus/lib/functions/hue.js new file mode 100644 index 00000000..3652f9d3 --- /dev/null +++ b/node_modules/stylus/lib/functions/hue.js @@ -0,0 +1,34 @@ +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')); +}; -- cgit v1.2.3