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

terminalpastel

v1.0.5

Published

TerminalPastel is a javascript tool which allows you to log text to the console in different colours and styles.

Downloads

318

Readme

TerminalPastel

Documentation

Table of Contents

Installation - Node JS

Navigate to your project folder in the cmd and run the following command.

npm install terminalpastel

Implementation - Web

Functions

  • format

tpastel.format('Hello World', {color: 'red', style: 'bold'}, true);

In this example, we are calling the tpastel.format function to format a string into a certain colour and/or style. The arguments passed into the function must take the following form.

argument1 - string to be formatted using Terminal Pastel argument 2 - an object containing 2 properties; 'color' and 'style' to specify what colour and style the text should be formatted to. Check out the Colours and Styles for more info. argument 3 - specifies whether the styles should be reset at the end of the string. If set to false, the styles will be carried to the next content logged to the console.

  • log

tpastel.log('Hello World', {color: 'yellow', style: 'bold'});

In this example, we are calling the tpastel.log function to format a string into a certain colour and/or style and log it to the console. The arguments passed into the function must take the following form.

argument1 - string to be formatted and logged to the console argument2 - an object containing 2 properties; 'color' and 'style' to specify what colour and style the text should be formatted to. Check out the Colours and Styles for more info.

  • f

tpastel.f('<Lorem ipsum:12> dolor, sit amet <consectetur:34>');

In this example, we call the pastel.f function. Instead of formatting the entire string, it formats parts of the string we specify using stylable blocks.

Stylable blocks are written in the following way.

<Text to be formatted:[style code][colour code]>

To get the colour/style codes, check out the Colours and Styles sections. Some example stylable blocks are given below.

<Lorem ipsum:11> // same as, {color: 'black', style: 'bold'};
<Lorem ipsum:34> // same as, {color: 'yellow', style: 'underline'};
<Lorem ipsum:36> // same as, {color: 'magenta', style: 'underline'};
<Lorem ipsum:42> // same as, {color: 'red', style: 'strikethrough'};

Colours

| Colour | Value | Code | | ------------ | --------- | ---- | | Default | default | 0 | | Black | black | 1 | | Red | red | 2 | | Green | green | 3 | | Yellow | yellow | 4 | | Blue | blue | 5 | | Magenta | magenta | 6 | | Cyan | cyan | 7 | | White | white | 8 |

Styles

| Style | Value | Code | | ------------ | --------- | ---- | | Default | default | 0 | | Bold | bold | 1 | | Italic | italic | 2 | | Underline | underline | 3 | | Strikethrough | strikethrough | 4 |

----- End -----