]>
Commit | Line | Data |
---|---|---|
c7b4bd19 BB |
1 | 'use strict'; |
2 | ||
3 | // Returns an ANSI Code for True Color, see: | |
4 | // https://en.wikipedia.org/wiki/ANSI_escape_code#Colors | |
5 | // and look for 24-bit colors. Only looks good in supported terminals, | |
6 | // otherwise looks like FakeColor. | |
fd38d409 RBR |
7 | /** |
8 | * Returns an ANSI code for 24-bit True Color, see | |
9 | * https://en.wikipedia.org/wiki/ANSI_escape_code#Colors and look for | |
10 | * 24-bit colors for more info. Only looks good in supported terminals, | |
11 | * otherwise looks like FakeColor | |
12 | * | |
13 | * @function TrueColorRenderer | |
14 | * @implements IRenderer | |
15 | */ | |
16 | module.exports = function (red, blue, green) { | |
17 | ||
c7b4bd19 BB |
18 | return `\x1B[48;2;${Math.round(red)};${Math.round(green)};${Math.round(blue)}m`; |
19 | }; |