# @stzhu/console-style-tag

> Package for styling console logs in developer tools.

Latest version **1.0.1** (published 2019-05-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stzhu/console-style-tag
pnpm add @stzhu/console-style-tag
yarn add @stzhu/console-style-tag
bun add @stzhu/console-style-tag
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-05-12 |
| First published | 2019-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Steve Zhu |
| Maintainers | stzhu |

## Links

- npm: https://www.npmjs.com/package/@stzhu/console-style-tag
- Repository: https://github.com/stevezhu/console-style-tag
- npm.io page: https://npm.io/package/@stzhu/console-style-tag

## Recent versions

- 1.0.1 (latest) — 2019-05-12
- 1.0.0 — 2019-05-12

## README

[![npm](https://img.shields.io/npm/v/@stzhu/console-style-tag.svg)](https://www.npmjs.com/package/@stzhu/console-style-tag)
[![GitHub](https://img.shields.io/github/license/stevezhu/console-style-tag.svg)](https://github.com/stevezhu/console-style-tag/blob/master/LICENSE)
[![Build Status](https://travis-ci.com/stevezhu/console-style-tag.svg)](https://travis-ci.com/stevezhu/console-style-tag)
[![Coverage Status](https://coveralls.io/repos/github/stevezhu/console-style-tag/badge.svg?branch=master)](https://coveralls.io/github/stevezhu/console-style-tag?branch=master)
[![devDependencies Status](https://david-dm.org/stevezhu/console-style-tag/dev-status.svg)](https://david-dm.org/stevezhu/console-style-tag?type=dev)

Package for styling console logs in developer tools.

# Usage

1. Styling

    The styles can be given as an object. Each key matches the index of the interpolated variable. In the following case, the style would apply to the word `'text'`.
      ```javascript
      consoleStyle({ 1: 'color: red' })`This is some ${'styled'} ${'text'}.`
      ```

    Styles can also be given as an array. Each index matches the index of the interpolated variable.
      ```javascript
      consoleStyle(['color: blue', 'color: red'])`This is some ${'styled'} ${'text'}.`
      ```

    Falsy styles are ignored.
      ```javascript
      consoleStyle([ undefined, 'color: red' ])`This is some ${'styled'} ${'text'}.`
      ```

2. The output can then be passed to `console.log` using the spread operator.
    ```javascript
    const output = consoleStyle([ undefined, 'color: red' ])`This is some ${'styled'} ${'text'}.`
    console.log(...output)
    ```

---
_Source: https://npm.io/package/@stzhu/console-style-tag · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
