# @nexssp/ansi

> Ansi, terminal colors library

Latest version **1.2.2** (published 2025-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nexssp/ansi
pnpm add @nexssp/ansi
yarn add @nexssp/ansi
bun add @nexssp/ansi
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.2 |
| Published | 2025-04-24 |
| First published | 2020-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | mapoart@gmail.com |
| Maintainers | nexss |
| Keywords | ansi, colors, terminal, typescript, types |

## Links

- npm: https://www.npmjs.com/package/@nexssp/ansi
- Repository: https://github.com/nexssp/ansi
- Homepage: https://nexss.com
- Issues: https://github.com/nexssp/ansi/issues
- npm.io page: https://npm.io/package/@nexssp/ansi

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.2.2 (latest) — 2025-04-24
- 1.2.1 — 2025-04-24
- 1.2.0 — 2025-04-24
- 1.1.5 — 2022-01-15
- 1.1.4 — 2022-01-15
- 1.1.3 — 2022-01-15
- 1.1.2 — 2021-05-18
- 1.1.1 — 2021-05-01
- 1.1.0 — 2021-05-01
- 1.0.7 — 2020-09-18
- 1.0.6 — 2020-09-18
- 1.0.5 — 2020-09-18
- 1.0.4 — 2020-09-18
- 1.0.3 — 2020-09-18

## README

# @nexssp/ansi

**15.01.2022 Upgrade** - Now works also with `import` as module.

```js
const ansi = require("@nexssp/ansi");
// or
import ansi from "@nexssp/ansi";
```

## New cursor functions

- now you can do **up**, **left**, **right**, **down** with the number of lines/columns.. eg. **ansi.up(5)**

## Available colors and functions

![image](https://user-images.githubusercontent.com/53263666/149625041-bd8a2769-858d-4e55-8dc0-7130d6772617.png)

reset, **bold**, _italic_, **underscore**, ~~strikethrough~~, inverse, **gray**, **grayBG** **purple**, **purpleBG**, **red**, **redBG** **redBG2**, **green**, **greenBG**, **greenBG2** **blue**, **blueBG**, **blueBG2**, **yellow**, **yellowBG**, **yellowBG2**, **magenta**, **magentaBG**, **magentaBG2**, **cyan**, **cyanBG**, **orangeBG**, **white**, **whiteBG**, **black**, **blackBG**

## Other functions

- **up**, **down**, **right**, **left**: moves cursor,
- **saveCursor**: save cursor position,
- **restoreCursor**: restore last savd position,
- **clearScreen**: clear screen,

## Examples

```js
const ansi = require("@nexssp/ansi"); // OR import ansi from "@nexssp/ansi";
// colors list
console.log(ansi.colors);
console.log(ansi.red("My red text"));

// or
const { red, blue, yellowBG, bold } = require("@nexssp/ansi");
console.log(red("my test" + yellowBG(bold("red bold and yellow background"))));
```

![image](https://user-images.githubusercontent.com/53263666/149625089-d97a44fd-8236-4a83-8de9-494c03545410.png)

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