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

color-term-console

v1.0.4

Published

Polyfills to use 'console' methods on server in the color terminal. Log, info, warn, error and others, colors, formatting and grouping support.

Downloads

8

Readme

What?

This is the simple Node module, which implements a few polyfills for the 'console' object methods to be used within the server or mobile code for pretty terminal output. Log, info, warn, error, debug, group and others - all with colors, formatting and grouping support. Fully React Native compatible!

Screenshot

If you have a better screenshot, do not hesitate to make a PR or just email it to me.

Why?

I have just been tired of the output given by React Native by default. Hope, you feel the same and will find this module useful.

Features

  • Log method type color labels;
  • JSON objects formatting (condensed and normal) with customizable colors;
  • Collapsable logs grouping (console.group* methods);
  • Method labels and JSON output color theming;
  • Support of the all with the same syntax you use in the browser consoin-browser logging syntax (e.g., console.log( "%cSome text", "color: green;" ))

Install

Run from your projects directory:

npm i --save color-term-console

How to use

You can just imprt the module once from your index file to enable it with the default settings:

import "color-term-console"

Remember to import it in front of other modules, which output to console.

To change the default behaviour:

import { condensedJsonOutput, setColorTheme } from "color-term-console"

...
condensedJsonOutput( true )

setColorTheme( {
	number: "tomato",
} )
...

API

condensedJsonOutput( mode: Boolean )

Switch between normal and condensed object output mode. In the condensed mode each line could contain several key: value pairs.

setColorTheme( theme: Object )

Change color theming options.

theme if the plain object containing all the values to be changed. Example:

{
	number: "tomato",
	warn: "blue",
}

Default theme:

{
	// json lexical types
	number: "olive",
	key: "blue",
	string: "green",
	boolean: "blue",
	null: "gray",
	// message types
	log: "white",
	debug: "gray",
	info: "cyan",
	warn: "yellow",
	error: "red",
	dir: "pink",
	dirxml: "pink",
}

Currently available colors:

  • black
  • white
  • grey
  • gray
  • red
  • tomato
  • green
  • acidgreen
  • yellow
  • olive
  • blue
  • navy
  • magenta
  • pink
  • cyan
  • darkcyan