From fd38d4096e65ba5afba8ed1ddc75ed1814ca8c16 Mon Sep 17 00:00:00 2001 From: Rubén Beltran del Río Date: Tue, 26 Jun 2018 22:00:10 +0000 Subject: Update Documentation --- lib/renderers/true_color.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/renderers/true_color.js') diff --git a/lib/renderers/true_color.js b/lib/renderers/true_color.js index 5f7725f..811d186 100644 --- a/lib/renderers/true_color.js +++ b/lib/renderers/true_color.js @@ -4,8 +4,16 @@ // 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. -const TrueColor = function (red, blue, green) { +/** + * 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`; }; - -module.exports = TrueColor; -- cgit