]>
git.r.bdr.sh - rbdr/tomato-sauce/blob - lib/renderers/256_colors.js
4 * Returns a 256 color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
7 * @function 256ColorsRenderer
8 * @implements IRenderer
10 module
.exports = function (red
, blue
, green
) {
12 const redValue
= Math
.round(red
* 5 / 255);
13 const blueValue
= Math
.round(blue
* 5 / 255);
14 const greenValue
= Math
.round(green
* 5 / 255);
16 const colorNumber
= 16 + 36 * redValue
+ 6 * greenValue
+ blueValue
;
18 return `\x1B[48;5;${colorNumber}m`;