blob: b15be7c08cda8702b5380363d99201a411d6a4d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
'use strict';
/**
* Returns a basic ansi color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
* for more info.
*
* @function ANSIRenderer
* @implements IRenderer
*/
module.exports = function (red, blue, green) {
const colorOffset = Math.round((red + blue + green) * 7 / (255 * 3));
const colorNumber = 40 + colorOffset;
return `\x1B[${colorNumber}m`;
};
|