🎨 Functional CLI ANSI formatter.
This package can be installed as a dependency or used directly.
In JS or deno:
import { isObject } from "https://cdn.skypack.dev/@vangware/forcli";
Or in HTML:
<script type="module" src="https://cdn.skypack.dev/@vangware/forcli"></script>
First:
npm i @vangware/forcli
And then:
import { whiteText, redBackground, bold, mix } from "@vangware/forcli";
const warningText = mix([whiteText, redBackground, bold]);
console.log(warningText("Warning!"));
Documentation can be found HERE. It is auto-generated with typedoc based on the JSDocs and the types in the source. Shouldn't be necessary to read this, code editors like VSCode integrate the documentation in the UI.
Changelog can be found HERE.
Test coverage can be found HERE.
Takes a source
string and adds the ANSI codes for black background.
Takes a source
string and adds the ANSI codes for black color.
Takes a source
string and adds the ANSI codes for blue background.
Takes a source
string and adds the ANSI codes for blue color.
Takes a source
string and adds the ANSI codes for bold text.
Takes a source
string and adds the ANSI codes for cyan background.
Takes a source
string and adds the ANSI codes for cyan color.
Takes a source
string and adds the ANSI codes for dimmed text.
Takes a source
string and adds the ANSI codes for gray color.
Takes a source
string and adds the ANSI codes for green background.
Takes a source
string and adds the ANSI codes for green color.
Alias for grayText
.
Takes a source
string and adds the ANSI codes for hidden text.
Takes a source
string and adds the ANSI codes for inverse text.
Takes a source
string and adds the ANSI codes for italic text.
Takes a source
string and adds the ANSI codes for magenta background.
Takes a source
string and adds the ANSI codes for magenta color.
Impure version of format
which changes depending on the current NodeJS
process
environment.
Takes a source
string and adds the ANSI codes for red background.
Takes a source
string and adds the ANSI codes for red color.
Takes a source
string and adds the ANSI codes for strikethrough text.
Takes an open
ANSI code and a source
string and adds the open and close
ANSI codes to that string (for text color).
Takes a source
string and adds the ANSI codes for underlined text.
Takes a source
string and adds the ANSI codes for white background.
Takes a source
string and adds the ANSI codes for white color.
Takes a source
string and adds the ANSI codes for yellow background.
Takes a source
string and adds the ANSI codes for yellow color.
Takes a source
number and returns the escape ANSI sequence.
Source to escape.
Escaped ANSI sequence.
Given an open
, a close
value and a source
string, return formatted
source
(surrounded by open
and close
).
Close value.
Curried function with close
in context.
Given a NodeJS process
, return true
if colors are enabled.
Composes formatters.
Array of formatters to be composed.
Generated using TypeDoc
Takes an
open
ANSI code and asource
string and adds the open and close ANSI codes to that string (for background color).Curried function with
close
ANSI code for background in context.