summaryrefslogtreecommitdiff
path: root/lib/renderers/256_colors.js
diff options
context:
space:
mode:
authorRubén Beltran del Río <ben@nsovocal.com>2018-06-26 22:00:10 +0000
committerRubén Beltran del Río <ben@nsovocal.com>2018-06-26 22:00:10 +0000
commitfd38d4096e65ba5afba8ed1ddc75ed1814ca8c16 (patch)
tree4d2c7a991fcc6510431af72225f7cea2c450f86a /lib/renderers/256_colors.js
parentbe12c97f83026087e0974fc54508b09c3154c9eb (diff)
Update Documentation
Diffstat (limited to 'lib/renderers/256_colors.js')
-rw-r--r--lib/renderers/256_colors.js23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/renderers/256_colors.js b/lib/renderers/256_colors.js
index e8e6e37..f6e57d3 100644
--- a/lib/renderers/256_colors.js
+++ b/lib/renderers/256_colors.js
@@ -1,16 +1,19 @@
'use strict';
-// Returns a 256 color, see
-// https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
-// under 256 colors for more info.
-const TwoFiftySixColors = function (red, blue, green) {
- let redValue = Math.round(red * 5 / 255);
- let blueValue = Math.round(blue * 5 / 255);
- let greenValue = Math.round(green * 5 / 255);
+/**
+ * Returns a 256 color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
+ * for more info.
+ *
+ * @function 256ColorsRenderer
+ * @implements IRenderer
+ */
+module.exports = function (red, blue, green) {
- let colorNumber = 16 + 36 * redValue + 6 * greenValue + blueValue;
+ const redValue = Math.round(red * 5 / 255);
+ const blueValue = Math.round(blue * 5 / 255);
+ const greenValue = Math.round(green * 5 / 255);
+
+ const colorNumber = 16 + 36 * redValue + 6 * greenValue + blueValue;
return `\x1B[48;5;${colorNumber}m`;
};
-
-module.exports = TwoFiftySixColors;