# Is colorette ESM-only? Can you require() it?

> colorette@2.0.20 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

🌈Easily set your terminal text color & styles.

Last verified Sep 9, 2026 against colorette@2.0.20.

colorette publishes both a CommonJS entry and a native ESM entry (ESM added in 1.2.1). require("colorette") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "colorette" works alongside it.

## What to do

1. Nothing to change. require("colorette") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as colorette from "colorette" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 2.0.20 (Apr 16, 2023)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 2.0.20
- Native ESM since: 1.2.1
- TypeScript types: bundled
- Node engines: not declared
- Weekly downloads: 52.9M
- License: MIT

## Runtime test results for colorette@2.0.20

Installed and executed on Sep 9, 2026 with require("colorette") from a CommonJS file and import "colorette" from an ES module.

| Runtime | require("colorette") | import "colorette" |
|---|---|---|
| Node.js 18 | works | works |
| Node.js 20 | works | works |
| Node.js 22 | works | works |
| Node.js 24 | works | works |
| Node.js 26 | works | works |
| Bun 1.4.0 | works | works |

## How to import colorette

ES modules:

```js
import * as colorette from "colorette";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
const colorette = require("colorette");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (37 versions; the newest 37 shown).

| Versions | Format | First published |
|---|---|---|
| 1.2.1 – 2.0.20 | Dual (CommonJS + ESM) | Jul 5, 2020 |
| 0.1.0 – 1.2.0 | CommonJS | Aug 23, 2018 |

## Frequently asked

**Is colorette ESM-only?**

colorette@2.0.20 ships CommonJS and ESM builds. colorette publishes both a CommonJS entry and a native ESM entry (ESM added in 1.2.1). require("colorette") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "colorette" works alongside it.

**Can I require colorette?**

Yes. colorette ships a CommonJS entry alongside the native ESM entry. require("colorette") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.

**Does colorette work in Bun?**

Yes. import "colorette" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does colorette ship TypeScript types?**

Yes. colorette bundles its own type declarations; no @types package is needed.

## Links

- [colorette on npm](https://www.npmjs.com/package/colorette)
- [Source repository](https://github.com/jorgebucaran/colorette)
- [HTML version](https://canirequire.com/package/colorette/)
- [JSON version](https://canirequire.com/package/colorette.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
