# ansi-colors-nestable

> Enables nested coloring of texts

Latest version **0.1.1** (published 2017-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ansi-colors-nestable
pnpm add ansi-colors-nestable
yarn add ansi-colors-nestable
bun add ansi-colors-nestable
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2017-12-15 |
| First published | 2017-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Takayuki Sato |
| Maintainers | sttk |
| Keywords | color, ansi, nest |

## Links

- npm: https://www.npmjs.com/package/ansi-colors-nestable
- Repository: https://github.com/sttk/ansi-colors-nestable
- Homepage: https://github.com/sttk/ansi-colors-nestable#readme
- Issues: https://github.com/sttk/ansi-colors-nestable/issues
- npm.io page: https://npm.io/package/ansi-colors-nestable

## Dependencies (1)

- [ansi-colors](https://npm.io/package/ansi-colors.md) ^1.0.1

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-12-15
- 0.1.0 — 2017-12-15

## README

# [ansi-colors-nestable][repo-url] [![NPM][npm-img]][npm-url] [![MIT License][mit-img]][mit-url] [![Build Status][travis-img]][travis-url] [![Build Status][appveyor-img]][appveyor-url] [![Coverage Status][coverage-img]][coverage-url]


Enables nested coloring of texts using [ansi-colors](https://www.npmjs.com/package/ansi-colors).


## Install

```sh
$ npm install ansi-colors-nestable --save-dev
```


## Usage

```js
const nestableColors = require('ansi-colors-nestable');

const ansiColors = require('ansi-colors');

const blue = nestableColors('blue');
const red = nestableColors(ansi.red);

blue('This package ', red('nested'), ' coloring of texts');
```


## API

### <u>nestableColors(color) : function</u>

Returns a function which accepts multiple argument texts and colors each of them with *color*.
If an argument text is already colored, that color is given precedence.
As a result, this function make coloring nestable.

This function uses the package [ansi-colors][ansi-colors-url] inside for supporting Node.js >= v0.10.
So color names need to be supported by [ansi-colors][ansi-colors-url].


#### Parameters:

| Parameter | Type               | Description                     |
|:----------|:------------------:|:--------------------------------|
| *color*   | string or function | color name or coloring function |

#### Returns:

A coloring function which can colorize multiple argument texts.

**Type:** function

The API of this returned function is as follows:

* <u>***color*****(...texts): string**</u>

    **Parameters:**

    | Parameter | Type      | Description          |
    |:----------|:---------:|:---------------------|
    | *texts*   | string(s) | texts to be colored. |

    **Returned:**
    
    A colored and concatenated text
    
    **Type:** string
    


### <u>nestableColors.noColor(...texts) : string</u>

This function has the same API with a returned function from nestableColors and simply returned a concatenated text of argument strings without coloring.

#### Parameters:

| Parameter | Type      | Description          |
|:----------|:---------:|:---------------------|
| *texts*   | string(s) | texts to be colored. |

#### Returned:

A concatenated text without coloring.
    
**Type:** string

## License

Copyright (C) 2017 Takayuki Sato

This program is free software under [MIT][mit-url] License.
See the file LICENSE in this distribution for more details.


[repo-url]: https://github.com/sttk/ansi-colors-nested/
[npm-img]: https://img.shields.io/badge/npm-v0.1.1-blue.svg
[npm-url]: https://www.npmjs.org/package/ansi-colors-nested/
[mit-img]: https://img.shields.io/badge/license-MIT-green.svg
[mit-url]: https://opensource.org/licenses.MIT
[travis-img]: https://travis-ci.org/sttk/ansi-colors-nestable.svg?branch=master
[travis-url]: https://travis-ci.org/sttk/ansi-colors-nestable
[appveyor-img]: https://ci.appveyor.com/api/projects/status/github/sttk/ansi-colors-nestable?branch=master&svg=true
[appveyor-url]: https://ci.appveyor.com/project/sttk/ansi-colors-nestable
[coverage-img]: https://coveralls.io/repos/github/sttk/ansi-colors-nestable/badge.svg
[coverage-url]: https://coveralls.io/github/sttk/ansi-colors-nestable?branch=master
[ansi-colors-url]: https://www.npmjs.com/package/ansi-colors

---
_Source: https://npm.io/package/ansi-colors-nestable · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
