npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

parcol

v0.1.5

Published

Parcol is a utility for parsing all ANSI colors methods in a string.

Downloads

58

Readme

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

| parcol | ansi colors | |--------|-------------| | bc | black | | bl | blue | | c | cyan | | g | green | | m | magenta | | r | red | | y | yellow | | w | white |

Bright (Hightlight) Colors

| parcol | ansi colors | |--------|--------------| | bcb | blackBright | | blb | blueBright | | cb | cyanBright | | gb | greenBright | | mb | magentaBright| | rb | redBright | | yb | yellowBright | | wb | whiteBright |

Background Colors

| parcol | ansi colors | |--------|-------------| | bgbc | bgBlack | | bgbl | bgBlue | | bgc | bgCyan | | bgg | bgGreen | | bgm | bgMagenta | | bgr | bgRed | | bgy | bgYellow | | bgw | bgWhite |

Bright Background Colors

| parcol | ansi colors | |--------|----------------| | bbcb | bgBlackBright | | bblb | bgBlueBright | | bcb | bgCyanBright | | bgb | bgGreenBright | | bmb | bgMagentaBright| | brb | bgRedBright | | byb | bgYellowBright | | bwb | bgWhiteBright |

Modifiers

| parcol | ansi colors | |--------|----------------| | b | bold | | d | dim | | h | hidden | | in | inverse | | it | italic | | l | terminalLink | | o | overline | | rs | reset | | st | strikethrough | | u | underline | | v | visible | | hex | hex | | rgb | rgb | | ans | ansi256 | | bgans| bgAnsi256 | | bghex| hex background | | bgrgb| rgb background |

LICENSE : MIT