npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grfti-cli

v0.6.0

Published

Spray color and gradients across your terminal, from the command line.

Readme

grfti-cli

Spray color and gradients across your terminal, from the command line. The CLI for grfti.

npm install -g grfti-cli
grfti sunset "hello world"
grfti "pink, cyan" "hello world"
grfti "gradient(green, yellow):reverse:vertical" -f banner.txt
figlet grfti | grfti vaporwave
grfti --list

Every picture on this page is a transcript: the command shown is the command that ran, and what you see under it is exactly what it printed — shellfie turned the captured buffer into SVG.

Usage

grfti [gradient] [text..]

The first argument is the gradient: a preset name, a comma-separated color list, or a full gradient(...) spec. The rest is the text — or pipe it in on stdin, or point at a file with -f.

| Option | | | --- | --- | | -d, --direction | horizontal, vertical, diagonal | | -s, --space | oklab, oklch, hsl, hsv, rgb | | -r, --reverse | Flip the gradient | | -b, --background | Paint the background instead of the text | | -D, --depth | Force truecolor, ansi256, ansi16 or none | | -f, --file | Read the text from a file | | --css | Print a CSS linear-gradient() | | --svg | Print an SVG <linearGradient> | | --hex | Print sampled hex values | | -n, --steps | How many samples for --hex (default 10) | | --angle | Angle for --css | | --id | Element id for --svg | | -i, --info | Describe a single color | | -l, --list | Preview every preset | | --colors | Preview every named color |

Flags and the DSL do the same work, so use whichever reads better in the shell:

grfti "pink, cyan" -d vertical -r "hello"
grfti "gradient(pink, cyan):vertical:reverse" "hello"

A typo comes back with the nearest match and a non-zero exit code, on stderr:

Colors

Anything grfti parses: a CSS color name, #rgb / #rgba / #rrggbb / #rrggbbaa, rgb(), rgba(), hsl(), hsv(), oklab(), oklch(), or ansi256(196). Quote specs that contain spaces or parentheses.

grfti "#ff7a59, #7c2bff" "hello"
grfti "rgb(255 122 89), oklch(0.6 0.24 295)" "hello"
grfti --info "hsl(210 80% 60%)"

--info prints a swatch plus the hex, rgb, hsl and oklch forms, the nearest 256- and 16-color palette entries, relative luminance, and WCAG contrast against white and black.

Using it in scripts

--hex, --css and --svg make the gradient available to whatever comes next:

grfti sunset --hex -n 5                    # five hex stops, one per line
grfti sunset --css                          # linear-gradient(90deg, ...)
grfti sunset --svg --id hero                # <linearGradient id="hero" ...>

for hex in $(grfti aurora --hex -n 4); do echo "$hex"; done

Examples

Every picture on this page is a script in examples/, and every one of them runs:

npm run examples                  # build, then render all 13
npm run example examples/hex.ts   # or just one

Both build first and then run through tsx, which is a devDependency — the examples shell out to dist/cli.js, so there has to be a dist.

█ is the widest thing a terminal can paint, so a file of them is the closest a text grid gets to a swatch — examples/sources/blocks.txt is six rows of nothing else, which is all the swatch at the top of this page is:

grfti sunset -f examples/sources/blocks.txt
grfti sunset -d diagonal -f examples/sources/blocks.txt
grfti "rainbow:vertical" -f examples/sources/blocks.txt

Each example defines grfti as a shell function pointing at dist/cli.js and runs it through bash, so pipes, loops and command substitution all work and the command in the script is the command in the picture. examples/README.md has the full table.

Color depth

Depth is detected from FORCE_COLOR, NO_COLOR, GRFTI_DEPTH, COLORTERM, TERM, TERM_PROGRAM, CI and whether stdout is a TTY. As with every well-behaved CLI, redirecting to a file or piping into another program drops the color:

grfti sunset "hello" > out.txt          # plain text
FORCE_COLOR=3 grfti sunset "hello" > out.txt   # keeps the escapes
grfti sunset "hello" -D truecolor       # same, per invocation
grfti sunset "hello" | less -R          # FORCE_COLOR=3 or -D truecolor

Development

Sources are pure TypeScript: no .js anywhere outside dist, and no file extensions in internal imports. The package is CommonJS with module: NodeNext, so ts-node runs the sources as-is:

npm start -- sunset "hello world"      # ts-node src/cli.ts
npx ts-node src/cli.ts --list
echo "hi" | npx ts-node src/cli.ts aurora
npm run typecheck   # tsc -p tsconfig.test.json, covers src and test, emits nothing
npm test            # vitest
npm run build       # tsc, src -> dist
npm run dev         # tsc --watch

License

MIT