X-Git-Url: https://git.r.bdr.sh/rbdr/tomato-sauce/blobdiff_plain/a140f3add912ef4bd659c1c1e82184643be7d845..36ff43dc094c3058bd26546454bb7a6776c685d3:/lib/renderers/ansi.js?ds=sidebyside diff --git a/lib/renderers/ansi.js b/lib/renderers/ansi.js index c3975da..b3a461d 100644 --- a/lib/renderers/ansi.js +++ b/lib/renderers/ansi.js @@ -1,13 +1,16 @@ 'use strict'; -// Returns a basic ANSI color. See the color table in: -// https://en.wikipedia.org/wiki/ANSI_escape_code#Colors -const ANSI = function (red, blue, green) { - let colorOffset = Math.round((red + blue + green) * 7 / (255 * 3)); +/** + * Returns a basic ansi color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors + * for more info. + * + * @function ANSIRenderer + * @implements IRenderer + */ +module.exports = function (red, blue, green) { - let colorNumber = 40 + colorOffset; + const colorOffset = Math.round((red + blue + green) * 7 / (255 * 3)); + const colorNumber = 40 + colorOffset; return `\x1B[${colorNumber}m`; }; - -module.exports = ANSI;