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

colog

v1.0.4

Published

colog - console log with colors

Downloads

14,182

Readme

#colog Build Status

###Installation

If you have Node.js and npm (Node Package Manager) installed, simply open console and type

npm install colog

###Usage

To use colog, add it to your project file

var colog = require('colog');

Then you can start creating colorful output for your console:

colog.success('Up and running');

If you did everything right, after you start your program like this:

node myApplication.js

You should see green text "Up and running";

For more informations check Wiki page for this project

##Cheatsheet

####Predefined options:

colog.question('How are you ?');

Full list

  • info() - white text
  • success() - green text
  • warning() - yellow text
  • error() - red text
  • question() - cyan text
  • answer() - magenta text
  • headerInfo() - black text, white background
  • headerSuccess() - white text, green background
  • headerWarning() - black text, yellow background
  • headerError() - white text, red background
  • headerQuestion() - white text, cyan background
  • headerAnswer() - white text, magenta background

####Applying colors, effects or background:

colog.log(colog.colorGreen('My text'));
colog.log(colog.backgroundGreen('My text'));

Available effects:

  • bold()
  • underline()
  • strike() (draw line on the text)
  • inverse() (change background color with text color and vice versa)

Also you can use .b(), .u(), .s() and .i() etc.

Available colors:

  • black()
  • red()
  • green()
  • yellow()
  • blue()
  • magenta()
  • cyan()
  • white()

Also you can use .colorBlack() instead of .black()

Available backgrounds:

  • bgBlack()
  • bgRed()
  • bgGreen()
  • bgYellow()
  • bgBlue()
  • bgMagenta()
  • bgCyan()
  • bgWhite()

Also you can use for example backgroundRed() instead of bgRed()

Others:

.nl() is alias for .newLine(). You get the point.

####Combining multiple effects:

colog.log(colog.underscore(colog.colorRed('My text')));
colog.log(colog.apply('My text', ['underscore', 'colorRed']));
colog.log(colog.color('My text', 'red') + colog.color('My text', 'green'));
colog.format('<question>How are you ?</question>');
colog.format('colog.format(<bold><colorRed>This</colorRed></bold> <underline><yellow>is</yellow></underline> <green>SPARTA</green><inverse>!</inverse>);');
colog.log(colog.format('<question>How are you ?</question>', false));

All options that can be used as tags: bold, underline, strike, inverse, colorBlack, colorRed, colorGreen, colorYellow, colorBlue, colorMagenta, colorCyan, colorWhite, backgroundBlack, backgroundRed, backgroundGreen, backgroundYellow, backgroundBlue, backgroundMagenta, backgroundCyan, backgroundWhite

Also: now you can use short names like "black", "bgGreen" etc. Same as methods listed above

Progress bar

To init a progress bar with 1000 steps that is charged 50% (5000 steps) just use:

colog.progress(5000, 10000);

Now you can advance progress bar by .progress() method with one or no arguments:

colog.progress(); // will add one step to progress bar
colog.progress(5); // will add 5 steps

Formating output

Now .format() method allow You to combine string with arguments just like .format() method from Node.js Util library

colog.format('My name is %s and I\'m %d', 'Earl', 45);

Status

Sometimes you want some description with status. This will print message on the left side of the screen and status on the right side. Script will measure size of your terminal and match position of both strings.

colog.status('Module message', '[OK]');
colog.status('Module <b>message</b>', '<b>[OK]</b>');

If script will be unable to check size of TTY, default cols will be used.

Silent mode

Sometimes you want Your colog to just shut up. You can do that using silent mode:

colog.silent(true);
colog.silent(false);

Dumping stuff

You can dump variables and functions at any point and apply effects to them.

colog.dump(variable);
colog.dump(variable, ['red', 'bgGreen']);

##Example output

Example

Author: Półtorak Dariusz [email protected] License: MIT