diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-08-25 12:33:03 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-08-25 12:33:03 +0200 |
| commit | 8ff1162897acc9a393f41edf9faf5593d6c66995 (patch) | |
| tree | b93e52d0b0c36a84b29fe0e5dde3d7401ec130eb /lib/renderers | |
| parent | 3ec8e14833b55d6bff4cf5702f90e1bb9a1b1e40 (diff) | |
Replace JS with rust
Diffstat (limited to 'lib/renderers')
| -rw-r--r-- | lib/renderers/256_colors.js | 19 | ||||
| -rw-r--r-- | lib/renderers/ansi.js | 16 | ||||
| -rw-r--r-- | lib/renderers/fake_color.js | 12 | ||||
| -rw-r--r-- | lib/renderers/true_color.js | 19 |
4 files changed, 0 insertions, 66 deletions
diff --git a/lib/renderers/256_colors.js b/lib/renderers/256_colors.js deleted file mode 100644 index 8fc67b2..0000000 --- a/lib/renderers/256_colors.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -/** - * Returns a 256 color, see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors - * for more info. - * - * @function 256ColorsRenderer - * @implements IRenderer - */ -module.exports = function (red, blue, green) { - - const redValue = Math.round(red * 5 / 255); - const blueValue = Math.round(blue * 5 / 255); - const greenValue = Math.round(green * 5 / 255); - - const colorNumber = 16 + 36 * redValue + 6 * greenValue + blueValue; - - return `\x1B[48;5;${colorNumber}m`; -}; diff --git a/lib/renderers/ansi.js b/lib/renderers/ansi.js deleted file mode 100644 index b15be7c..0000000 --- a/lib/renderers/ansi.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * 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) { - - const colorOffset = Math.round((red + blue + green) * 7 / (255 * 3)); - const colorNumber = 40 + colorOffset; - - return `\x1B[${colorNumber}m`; -}; diff --git a/lib/renderers/fake_color.js b/lib/renderers/fake_color.js deleted file mode 100644 index d0482dc..0000000 --- a/lib/renderers/fake_color.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -/** - * Returns a malformed 24-bit ansi color - * - * @function FakeColorRenderer - * @implements IRenderer - */ -module.exports = function (red, blue, green) { - - return `\x1B[28;2;${Math.round(red)};${Math.round(green)};${Math.round(blue)}m`; -}; diff --git a/lib/renderers/true_color.js b/lib/renderers/true_color.js deleted file mode 100644 index ae7d11f..0000000 --- a/lib/renderers/true_color.js +++ /dev/null @@ -1,19 +0,0 @@ -'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`; -}; |