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

tiza

v2.2.1

Published

Console styling for browsers

Downloads

65

Readme

Tiza

build coverage npm gzip size

Tiza is a JavaScript library for browsers' console styling.

View demo here: https://tiza.js.org

Installation

NPM

npm install --save tiza

Then import it:

import tiza from 'tiza'
// or via require if you are using commonjs
const tiza = require('tiza').default

UMD bundle

Add script tag to your HTML file:

<script src="https://unpkg.com/tiza/dist/tiza.min.js"></script>

Usage

import tiza from 'tiza'

tiza
  .color('#fff') // Set color, all CSS colors are supported
  .bgColor('purple') // Set background color
  .bold() // Set bold font
  .italic() // Set italic font
  .size(20) // Set font size

  // Support custom styles too!
  .style(`padding: 4px; border-radius: 2px;`)

  // After styles done right, it's time to add text now
  .text('Hey, I have styling now!')

  .space(8) // Add spaces
  .text('Hey, I am far away from previous one')

  .newline(2) // Add newline

  .reset() // Reset all styles set before

  .text('I lost my styles, because `reset` is called')

  .log() // log all texts above to console

Always remember to call log method at last.

Styles reusing

To reuse styles, just make them nested like this:

const error = tiza.color('red').text
const info = tiza.bold().bgColor('yellow').text

tiza.log(
  error('I am some error'),
  'I am some normal message',
  error('I am some error again!'),
  info('I am some info', error('I am still some error!')),
)

Notice that inside texts will not extend outside texts' styles.

For more detail see API

How does it work?

https://developers.google.com/web/tools/chrome-devtools/console/console-write

Find Styling console output with CSS

Who's using Tiza

Console Importer

API

| Method | Description | | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | tiza.color('#f00') | Set font color, support all CSS colors | | tiza.bgColor('#f00') | Set background color, support all CSS colors | | tiza.bold() | Set font weight to bold | | tiza.italic() | Set font style to italic | | tiza.size(14) | Set font size, number will be converted to px | | tiza.style('color:#f00') | Set custom style, using inline style format | | tiza.reset() | Reset styles set before | | tiza.text(...args: string[]) | Add text(s), support multiple arguments. Every text added here will be styled with styles set previously. Notice that every argument will be converted to string, and there will be no space between them(This behaviour is different with console.log). If you want to add a space, use text('a').space().text('b') | | tiza.space(count?: number) | Add space. The default count is 1 | | tiza.newline(count?: number) | Add newline. The default count is 1 | | tiza.log() | Log all texts to console with console.log. Always remember to call log at last. Arguments are also supported, log(...args) equals to text(...args).log() | | tiza.info() | The same as tiza.log, but output with console.info | | tiza.warn() | The same as tiza.log, but output with console.warn | | tiza.error() | The same as tiza.log, but output with console.error |

License

MIT