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

escprint

v1.0.2

Published

A minimalist package for styling command line outputs

Downloads

89

Readme

escprint

A minimalist package for styling command line outputs

Usage

prnt function

  • Use <style...> to add that style to the current output style
  • Use </style...> to reset the output style and then set the style to whatever is in the tag
  • Use </> to reset the output style
  • Use a , to deliminate multiple styles

Example

import {prnt} from "escprint";

prnt(`
    This is normal 
    <cyan> this is cyan 
    <underline> this is cyan and underlined 
    </green> this is just green 
    </> this is normal again
`);

// use "," to use multiple styles

prnt(`
    <red,underline> This is red and underlined
    </italic> This is just italic 
`);

The prnt function automatically resets the command line styles after it has been called.

Importing Styles Directly

If you don't feel like using the prnt function, you can import the styles directly and use them in a console.log or other functions;

Don't forget to reset the styles after using them

import {BLUE,UNDERLINE,X,YELLOW} from "escprint"; 

// X means reset styles
console.log(`
    This is normal 
    ${BLUE} This is blue
    ${UNDERLINE} this is blue and underlined
    ${X+YELLOW} this is just yellow
    ${X}
`);

or

import readline from "readline";
import {CYAN,X} from "escprint"; 

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

const prompt = `${CYAN}What is your name? ${X}`; 

rl.question(prompt, (input) => {
    rl.close();
    resolve(input);
});

Recognized Styles

Text Decoration

| String | Description | | ------ | ----------- | | reset | reset formatting to default | | bold | make text bold | | dim | make text dim | | blink | make text blink | | italic | make text italic | | i | italic shorthand | | underline | underline text | | u | underline shorthand |

Color

| String | Description | | ------ | ----------- | | black | set foreground color to black | | white | set foreground color to white | | red | set foreground color to red| | green | set foreground color to green | | yellow | set foreground color to yellow | | blue | set foreground color to blue | | magenta | set foreground color to magenta | | cyan | set foreground color to cyan | | Black | set foreground color to bright black | | White | set foreground color to bright white | | Red | set foreground color to bright red| | Green | set foreground color to bright green | | Yellow | set foreground color to bright yellow | | Blue | set foreground color to bright blue | | Magenta | set foreground color to bright magenta | | Cyan | set foreground color to bright cyan | | bblack | set background color to black | | bwhite | set background color to white | | bred | set background color to red| | bgreen | set background color to green | | byellow | set background color to yellow | | bblue | set background color to blue | | bmagenta | set background color to magenta | | bcyan | set background color to cyan | | bBlack | set background color to bright black | | bWhite | set background color to bright white | | bRed | set background color to bright red| | bGreen | set background color to bright green | | bYellow | set background color to bright yellow | | bBlue | set background color to bright blue | | bMagenta | set background color to bright magenta | | bCyan | set background color to bright cyan |

Other

| String | Description | | ------ | ----------- | | reverse | reverse foreground & background | | hidden | hide text | | strike | strikethrough text | | strikethrough | strikethrough text| | delete | delete character | | home | set cursor to home position | | request | request cursor position | | savecursor | save cursor position | | restorecursor | restore cursor position |