From 15e0d96b891f6dddce51378d6a1a0c733c1ac525 Mon Sep 17 00:00:00 2001 From: alecmolloy Date: Sun, 28 Aug 2016 11:04:06 -0700 Subject: [PATCH 1/2] adding rgb and rgba color functions for more straightforward color creation --- lib/language/modules/colors.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/language/modules/colors.js b/lib/language/modules/colors.js index b90eeb2c9..ddaac1219 100644 --- a/lib/language/modules/colors.js +++ b/lib/language/modules/colors.js @@ -136,6 +136,31 @@ function rotate(color, amount) { return Color(color).rotate(amount).rgbaString(); } +/* + * Rotate color hue by given amount + * + * @param {Number} red + * @param {Number} green + * @param {Number} blue + * @return {String} + */ +function rgb(red, green, blue) { + return "rgb(" + red + ", " + green + ", " + blue + ")"; +} + +/* + * Rotate alpha color hue by given amount + * + * @param {Number} red + * @param {Number} green + * @param {Number} blue + * @param {Number} alpha + * @return {String} + */ +function rgba(red, green, blue, alpha) { + return "rgba(" + red + ", " + green + ", " + blue + ", " + alpha + ")"; +} + /* * Get color opacity or set it to value if it's passed * @@ -233,9 +258,11 @@ module.exports = { hue : hue, setTransparency : setTransparency, rotate : rotate, + rgb : rgb, + rgba : rgba, opacity : opacity, opacize : opacize, transparentize : transparentize, setBrightness : setBrightness, setSaturation : setSaturation -}; \ No newline at end of file +}; From f99da23459fa88ad1bb89a0cf2ee390b4ce80b12 Mon Sep 17 00:00:00 2001 From: Alec Molloy Date: Tue, 30 Aug 2016 23:44:37 -0700 Subject: [PATCH 2/2] add a transparent `"rgba(0,0,0,0)"` color --- lib/language/modules/palette.json | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/language/modules/palette.json b/lib/language/modules/palette.json index 5dfa3d09c..2cf513c92 100644 --- a/lib/language/modules/palette.json +++ b/lib/language/modules/palette.json @@ -137,6 +137,7 @@ "steelblue" : "#4682B4", "tan" : "#D2B48C", "teal" : "#008080", + "transparent" : "rgba(0,0,0,0)", "thistle" : "#D8BFD8", "tomato" : "#FF6347", "turquoise" : "#40E0D0",