aboutsummaryrefslogtreecommitdiff
path: root/lib/renderers/true_color.js
blob: ae7d11f2e0bd57e7a83df1c4ff425e6c54acd052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

// Returns an ANSI Code for True Color, see:
// https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
// and look for 24-bit colors. Only looks good in supported terminals,
// otherwise looks like FakeColor.
/**
 * Returns an ANSI code for 24-bit True Color, see
 * https://en.wikipedia.org/wiki/ANSI_escape_code#Colors and look for
 * 24-bit colors for more info. Only looks good in supported terminals,
 * otherwise looks like FakeColor
 *
 * @function TrueColorRenderer
 * @implements IRenderer
 */
module.exports = function (red, blue, green) {

    return `\x1B[48;2;${Math.round(red)};${Math.round(green)};${Math.round(blue)}m`;
};