# picocolors — card for AI agents

Tiny fast library for terminal ANSI color output in CLI tools.

Category: Dev workflow and config · npm package `picocolors` · latest version 1.1.1 (checked 2026-11-01)
Install: `npm install picocolors`
License: ISC (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Numbers (AgentGid data)
- Gid Score: 63.2 (#789 of all tools, 56 of 299 in its category)
- Used in 15 public projects set up for AI coding agents (0.2%)
- Downloads last week: 358,023,407 (as of 2026-11-24), +38.8% over 4 weeks
- GitHub stars: 1,757 (as of 2026-11-24)
- Last push: 2024-11-18

## Often used with
tsx 50.0%, TypeScript 91.7%, Clack Prompts 38.5%, Commander 31.2%, Vitest 51.0%, Zod 55.2%

## Checked alternatives (same job)
- chalk: https://agentgid.com/tools/chalk/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/picocolors/
- Homepage: https://github.com/alexeyraspopov/picocolors#readme
- Repository: https://github.com/alexeyraspopov/picocolors


## picocolors: colored text for command-line tools

picocolors is a very small free JavaScript library that paints text in the terminal, like a green tick for done or red for an error. Your own command-line tools and scripts become easier to read. It turns colors off by itself when the output goes to a file or the person asked for no color.

### Where to use it
- Readable build and deploy messages: A script that builds or deploys your site prints done in green, warnings in yellow and failures in red, so problems stand out in a long log.
- A no-color option in your tool: Give people a switch that prints plain text, for screen readers, old terminals or saved logs.
- Make a tool lighter by dropping chalk: A small tool that only needs a few colors can swap chalk for picocolors and keep the same output.
- Respect people who turned color off: People who set NO_COLOR, or pass a no-color flag, get plain text from your tool without extra code.
- Highlight results of a data script: A one-off script that cleans a spreadsheet or checks links prints the rows it changed in green and the ones it skipped in gray. (idea, not from the official pages)

### How to start
- Add picocolors to your Node.js project with your package manager (npm install picocolors), then import it.

```
import pc from "picocolors"
```

- Wrap the text you print in a color or style function; nest calls to combine them.

```
console.log(
  pc.green(`How are ${pc.italic(`you`)} doing?`)
)
```


### License
Free for any use, including paid products, under the ISC license. Keep the copyright and license notice with copies of its files.

### Good to know
- It has no other packages inside and runs on very old Node.js versions too.
- It has only the 16 basic terminal colors plus bold, dim, italic and similar styles; there is no way to pick an exact color code like a brand hex value.
- Colors are on in a terminal, on build servers that set CI, and with FORCE_COLOR; output piped to a file stays plain.
- The last release, 1.1.1, came out on 16 October 2024; the library is small and changes rarely.
- When a site is bundled for the browser, picocolors swaps in a version that returns plain text.

Checked 2026-11-11 against: https://github.com/alexeyraspopov/picocolors/blob/main/README.md, https://github.com/alexeyraspopov/picocolors/blob/main/LICENSE, https://github.com/alexeyraspopov/picocolors/blob/main/package.json, https://github.com/alexeyraspopov/picocolors/blob/main/picocolors.js, https://registry.npmjs.org/picocolors, https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz

### Mistakes to avoid
- Don't: pc.red.bold("Failed") → Do: pc.red(pc.bold("Failed")) (picocolors functions are plain functions without chained properties; chalk-style chains do not exist.)
- Don't: pc.hex("#2B59C3")("Brand") or pc.rgb(...) → Do: Use one of the 16 named colors (pc.blue, pc.cyanBright ...) or switch to chalk for exact colors (The README lists only named colors, backgrounds and styles; there is no hex or rgb function.)
- Don't: Expecting colored strings in a web page or browser console after bundling → Do: Use picocolors only for terminal output; style web pages with CSS (The package's browser entry maps to a build where every function returns the plain string.)
- Don't: Writing pc.red(...) results into a JSON log or a file that other programs read → Do: Make a plain set with pc.createColors(false) for anything that is not shown in a terminal (With colors on, the strings carry escape codes; in our run line 4 came back as "\u001b[31m\u001b[1m✖ Upload failed:...")
- Don't: Colors missing in CI logs and adding chalk just to force them → Do: Set FORCE_COLOR=1 (or pass --color) in the CI job; CI=true alone already turns them on (picocolors checks FORCE_COLOR, --color, a terminal and CI before it turns colors on (our run showed true for CI=true).)

### Questions
- Does it work with both require and import? Yes. The README says it supports both CommonJS and ES module projects and ships TypeScript types.
- Can I write chalk.red.bold style chains? No. You nest calls instead, like pc.red(pc.bold(text)).
- How do I know if colors will show? Read pc.isColorSupported. It is false when NO_COLOR is set, with --no-color, or when output is not a terminal.
- Can I use it in a commercial tool? Yes. The ISC license allows any use with or without fee, as long as the notice stays with copies.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
