# supports-terminal-graphics

> Detect which terminal graphics protocols are supported (Kitty, iTerm2, Sixel)

Latest version **0.1.0** (published 2026-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install supports-terminal-graphics
pnpm add supports-terminal-graphics
yarn add supports-terminal-graphics
bun add supports-terminal-graphics
```

## Health

**Score 60/100 (C)** — status: stable.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2026-01-04 |
| First published | 2026-01-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 0 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | terminal, graphics, kitty, iterm, iterm2, sixel, wezterm, konsole, ghostty, image, images, inline, protocol, detect, check, support, cli, tty, console |

## Links

- npm: https://www.npmjs.com/package/supports-terminal-graphics
- Repository: https://github.com/sindresorhus/supports-terminal-graphics
- Homepage: https://github.com/sindresorhus/supports-terminal-graphics#readme
- Issues: https://github.com/sindresorhus/supports-terminal-graphics/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/supports-terminal-graphics

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2026-01-04

## README

# supports-terminal-graphics

> Detect which terminal graphics protocols are supported ([Kitty](https://sw.kovidgoyal.net/kitty/graphics-protocol/), [iTerm2](https://iterm2.com/documentation-images.html), [Sixel](https://en.wikipedia.org/wiki/Sixel))

Detects support for terminal graphics protocols using environment variables. This allows apps to choose the best available protocol for displaying images in the terminal.

## Protocols

| Protocol | Quality | Description |
|----------|---------|-------------|
| **Kitty** | Best | Truecolor RGBA, transparency, animation support |
| **iTerm2** | Good | Full color, native macOS rendering |
| **Sixel** | Basic | Palette-based, widely supported legacy protocol |

## Install

```sh
npm install supports-terminal-graphics
```

## Usage

```js
import supportsTerminalGraphics from 'supports-terminal-graphics';

if (supportsTerminalGraphics.stdout.kitty) {
	// Use Kitty graphics protocol (best quality)
} else if (supportsTerminalGraphics.stdout.iterm2) {
	// Use iTerm2 inline images protocol
} else if (supportsTerminalGraphics.stdout.sixel) {
	// Use Sixel protocol
} else {
	// Fall back to ANSI block characters
}
```

You can also check `stderr`:

```js
if (supportsTerminalGraphics.stderr.kitty) {
	// Use Kitty graphics protocol on stderr
}
```

## API

### supportsTerminalGraphics

Returns an object with `stdout` and `stderr` properties, each containing:

- `kitty` - `boolean` - Whether Kitty graphics protocol is supported
- `iterm2` - `boolean` - Whether iTerm2 inline images protocol is supported
- `sixel` - `boolean` - Whether Sixel protocol is supported

### createSupportsTerminalGraphics(stream?)

Create a custom check for a specific stream.

```js
import {createSupportsTerminalGraphics} from 'supports-terminal-graphics';

const support = createSupportsTerminalGraphics(process.stdout);

console.log(support.kitty);  // true or false
console.log(support.iterm2); // true or false
console.log(support.sixel);  // true or false
```

## Terminal Support

| Terminal | Kitty | iTerm2 | Sixel |
|----------|-------|--------|-------|
| Kitty | ✓ | | |
| Ghostty | ✓ | | |
| WezTerm | ✓ | ✓ | ✓ |
| iTerm2 (v3.6+) | ✓ | ✓ | |
| iTerm2 (v2.9.20150512+) | | ✓ | |
| Konsole (22.04+) | ✓ | ✓ | ✓ |
| VS Code (v1.80+) | | ✓ | ✓ |
| Rio | ✓ | ✓ | ✓ |
| Warp | ✓ | | |
| mintty | | ✓ | ✓ |
| mlterm | | | ✓ |

## Related

- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
- [supports-hyperlinks](https://github.com/chalk/supports-hyperlinks) - Detect whether a terminal supports hyperlinks
- [terminal-image](https://github.com/sindresorhus/terminal-image) - Display images in the terminal

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