0.1.5 • Published 9 months ago

parcol v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Parcol Parse ANSI Colors

Parcol is a utility for parsing all Chalk methods in a string.

Table of Contents

Syntax

~(color_key) (your_text)~

We refer to the text enclosed between ~ ~ as parcol. Instead of the color key in the syntax above, you can find a table of color key methods converted to Parcol keys below ANSI colors.

The simplest usage example is bl for blue. So when you type ~bl ...~, Parcol will convert your code to c.blue("...").

Installation

You can install Parcol into your project using your package manager like npm, yarn, pnpm, etc. Below is an example using Yarn.

yarn add parcol

Usage

The following code demonstrates how Parcol converts text to specific ANSI colors. It will convert the text "blue" to c.blue("blue"), so the blue text will remain blue while other texts will not be modified.

import parcol from "parcol";

const my_text = "this is a ~bl blue~ message";

parcol.pit(my_text);

Examples

Below are some usage examples for Parcol.

Using Parcol Multiple Times in a String

It is possible to use Parcol multiple times in a single string expression.

import parcol from "parcol";

parcol.pit("~y hi~ ~r red~, my favorite color is ~bl blue~ but I also love ~m purple~");

Using Multiple Methods

To apply more than one method, separate them with a comma (,). Here is an example using bl,d:

import parcol from "parcol";

// It sets the text to both blue and dim (bl,d).
parcol.pit("this is a ~bl,d blue~ message", "and this is ~d dim~ text");

All Color Keys

You can find all Parcol color keys below. The tables consist of two columns: the first column lists the color keys available in Parcol, and the second column shows the corresponding method names in ANSI colors.

Basic Colors

parcolansi colors
bcblack
blblue
ccyan
ggreen
mmagenta
rred
yyellow
wwhite

Bright (Hightlight) Colors

parcolansi colors
bcbblackBright
blbblueBright
cbcyanBright
gbgreenBright
mbmagentaBright
rbredBright
ybyellowBright
wbwhiteBright

Background Colors

parcolansi colors
bgbcbgBlack
bgblbgBlue
bgcbgCyan
bggbgGreen
bgmbgMagenta
bgrbgRed
bgybgYellow
bgwbgWhite

Bright Background Colors

parcolansi colors
bbcbbgBlackBright
bblbbgBlueBright
bcbbgCyanBright
bgbbgGreenBright
bmbbgMagentaBright
brbbgRedBright
bybbgYellowBright
bwbbgWhiteBright

Modifiers

parcolansi colors
bbold
ddim
hhidden
ininverse
ititalic
lterminalLink
ooverline
rsreset
ststrikethrough
uunderline
vvisible
hexhex
rgbrgb
ansansi256
bgansbgAnsi256
bghexhex background
bgrgbrgb background

LICENSE : MIT