# ansi-template

> Super-simple templating for ansi-styles

Latest version **1.0.0** (published 2015-02-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install ansi-template
pnpm add ansi-template
yarn add ansi-template
bun add ansi-template
```

## 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.0 |
| Published | 2015-02-21 |
| First published | 2015-02-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | olizilla |
| Maintainers | olizilla |
| Keywords | chalk, colors, template |

## Links

- npm: https://www.npmjs.com/package/ansi-template
- npm.io page: https://npm.io/package/ansi-template

## Dependencies (1)

- [ansi-styles](https://npm.io/package/ansi-styles.md) ^2.0.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-02-21

## README

# ansi-template
A String.prototype friendly replacement for colors-tmpl

[Workshopper][1] use [colors-tmpl][2] to replace `{red}`-like template commands with ansi colour / formatting codes.
It also uses `chalk` for ad-hoc terminal formatting.

```js
var ansi = require('ansi-template')
ansi('{red}Error{/red} don\'t hold much hope for the {underline}creedence tapes{/underline}')

// will return a strin with the {foo}'s replaced with the equivelant ansi-style code
```

This module is intended to be a simpler, chalk friendly alternative to colors-tmpl with no String.prototype noodling.

But then I found that `colors/safe` as used by [colors-tmpl][2] doesn't have the same String.prototpye noodling horror.
So, a timely reminder to research before adding to the pile of code. Regardless, if you want super simple colors-tmpl style templatin
for crafting terminal messages from plain text without having to look at the madness that is ansi formatting codes, this'll do that.

Made possible by the clean seperation of concerns that is [chalk][3] and [ansi-styles][4]

[1]: https://github.com/rvagg/workshopper
[2]: https://github.com/rvagg/colors-tmpl
[3]: https://github.com/sindresorhus/chalk
[4]: https://github.com/sindresorhus/ansi-styles

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