X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/a140f3add912ef4bd659c1c1e82184643be7d845..a0666be3ab58ed83ad6d622cfe2b8293c40dffbb:/lib/renderers/true_color.js diff --git a/lib/renderers/true_color.js b/lib/renderers/true_color.js index 5f7725f..ae7d11f 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) { - return `\x1B[48;2;${Math.round(red)};${Math.round(green)};${Math.round(blue)}m`; -}; +/** + * 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) { -module.exports = TrueColor; + return `\x1B[48;2;${Math.round(red)};${Math.round(green)};${Math.round(blue)}m`; +};