Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansis

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansis - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

2

package.json
{
"name": "ansis",
"version": "3.2.0",
"version": "3.2.1",
"description": "Colorize terminal with ANSI colors & styles",

@@ -5,0 +5,0 @@ "keywords": [

<p align="center">
<a href="https://github.com/webdiscus/ansis">
<img width="323" src="docs/img/ansis-logo.png" alt="ansis"><br>
<img width="323" src="https://github.com/webdiscus/ansis/raw/master/docs/img/ansis-logo.png" alt="ansis"><br>
ANSI Styling

@@ -9,11 +9,14 @@ </a>

---
[![node](https://img.shields.io/node/v/ansis)](https://nodejs.org)
[![Test](https://github.com/webdiscus/ansis/actions/workflows/test.yml/badge.svg)](https://github.com/webdiscus/ansis/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/webdiscus/ansis/branch/master/graph/badge.svg?token=H7SFJONX1X)](https://codecov.io/gh/webdiscus/ansis)
[![node](https://img.shields.io/npm/dm/ansis)](https://www.npmjs.com/package/ansis)
[![size](https://img.shields.io/bundlephobia/minzip/ansis)](https://bundlephobia.com/package/ansis)
Colorize terminal with ANSI colors & styles, **smaller** and **faster** alternative to [Chalk](https://github.com/chalk/chalk).
Colorize terminal with ANSI colors & styles, smaller and faster alternative to Chalk.
#### Usage example
🚀 [Install and Quick Start](https://github.com/webdiscus/ansis#install)
📖 [Read full docs on GitHub](https://github.com/webdiscus/ansis)
## Usage
```js

@@ -27,8 +30,5 @@ import ansis, { red, green, black, ansi256, hex } from 'ansis';

ansi256(214)`Orange`
hex('#E0115F').bold.underline('Hello TrueColor!')
hex('#E0115F').bold.underline('TrueColor')
```
🚀 [Install and Quick Start](https://github.com/webdiscus/ansis#install)\
📖 [Read full docs on GitHub](https://github.com/webdiscus/ansis)
## 🏆 Compare & Benchmark

@@ -41,26 +41,20 @@

![ANSI demo](docs/img/ansis-demo.png)
![ANSI demo](https://github.com/webdiscus/ansis/raw/master/docs/img/ansis-demo.png)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/stackblitz-starters-gs2gve?file=index.js)
- Supports **ESM**, **CommonJS**, **TypeScript**, **Bun**, **Deno**, **Next.JS**
- [Standard API](https://github.com/webdiscus/ansis#base-colors) compatible with **Chalk**
- Default and [named import](https://github.com/webdiscus/ansis#named-import) `import ansis, { red, green, bold, underline } from 'ansis'`
- [Chained syntax](https://github.com/webdiscus/ansis#chained-syntax) `red.bold.underline('text')`
- [Nested **template strings**](https://github.com/webdiscus/ansis#nested-syntax) ``` red`RED text ${green`GREEN text`} RED text` ```
- [Base ANSI styles](https://github.com/webdiscus/ansis#base-colors) `dim` **`bold`** _`italic`_ <u>`underline`</u> <s>`strikethrough`</s>
- [Base ANSI 16 colors](https://github.com/webdiscus/ansis#base-colors) ``` red`Error!` ``` ``` redBright`Error!` ``` ``` bgRed`Error!` ``` ``` bgRedBright`Error!` ```
- [ANSI 256 colors](https://github.com/webdiscus/ansis#256-colors) ``` fg(56)`violet` ``` ``` bg(208)`orange` ```
- [TrueColor](https://github.com/webdiscus/ansis#truecolor) (**RGB**, **HEX**) ``` rgb(224, 17, 95)`Ruby` ```, ``` hex('#96C')`Amethyst` ```
- [Fallback](https://github.com/webdiscus/ansis#fallback) to supported color space: TrueColor → 256 colors → 16 colors → no colors
- [ANSI codes](https://github.com/webdiscus/ansis#escape-codes) as `open` and `close` properties ``` `Hello ${red.open}World${red.close}!` ```
- [Strip ANSI codes](https://github.com/webdiscus/ansis#strip) method `ansis.strip()`
- [Correct style break](https://github.com/webdiscus/ansis#new-line) at the `end of line` when used `\n` in string
- Detect [color support](https://github.com/webdiscus/ansis#color-support) using `ansis.isSupported()` method
- Supports [CLI](https://github.com/webdiscus/ansis#cli-vars) `NO_COLOR` `FORCE_COLOR` `--no-color` `--color`
- Supports ESM, CommonJS, TypeScript, Bun, Deno, Next.JS
- [Standard API](https://github.com/webdiscus/ansis#base-colors), drop-in replacement for Chalk
- Default and named import: `import ansis, { red, bold, hex } from 'ansis'`
- Chained syntax: `red.bold.underline('text')`
- Nested template strings: ``` red`RED ${green`GREEN`} RED` ```
- ANSI styles: `dim` **`bold`** _`italic`_ <u>`underline`</u> <s>`strikethrough`</s>
- ANSI 16 colors: ``` red`Error!` ``` ``` redBright`Error!` ``` ``` bgRed`Error!` ``` ``` bgRedBright`Error!` ```
- ANSI 256 colors: ``` fg(56)`violet` ``` ``` bg(208)`orange` ```
- TrueColor: ``` rgb(224, 17, 95)`Ruby` ``` ``` hex('#96C')`Amethyst` ```
- Color fallback: TrueColor → 256 colors → 16 colors → no colors
- Raw ANSI codes: ``` `foo ${red.open}red{red.close} bar` ```
- Strip ANSI codes: `ansis.strip()`
- Detect color support: `ansis.isSupported()`
- Supports CLI: `NO_COLOR` `FORCE_COLOR` `--no-color` `--color`
- Correct style break at the `end of line` when used `\n`
- Doesn't extend `String.prototype`
- Zero dependencies
## License
[ISC](https://github.com/webdiscus/ansis/blob/master/LICENSE)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc