]> git.r.bdr.sh - rbdr/tomato-sauce/blob - lib/renderers/ansi.js
Use variable for interval
[rbdr/tomato-sauce] / lib / renderers / ansi.js
1 'use strict';
2
3 /**
4 * Returns a basic ansi color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
5 * for more info.
6 *
7 * @function ANSIRenderer
8 * @implements IRenderer
9 */
10 module.exports = function (red, blue, green) {
11
12 const colorOffset = Math.round((red + blue + green) * 7 / (255 * 3));
13 const colorNumber = 40 + colorOffset;
14
15 return `\x1B[${colorNumber}m`;
16 };