MCPcopy Index your code
hub / github.com/bokub/chalk-animation

github.com/bokub/chalk-animation @2.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0.3 ↗ · + Follow
14 symbols 23 edges 3 files 0 documented · 0% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

chalk-animation

Build Status Version Codecov Downloads XO code style

Colorful animations in terminal output

Available animations

Name Preview
rainbow rainbow
pulse pulse
glitch glitch
radar radar
neon neon
karaoke karaoke

Install

$ npm i chalk-animation

Usage

import chalkAnimation from 'chalk-animation';

chalkAnimation.rainbow('Lorem ipsum dolor sit amet');

Start and stop

You can stop and resume an animation with stop() and start().

When created, the instance of chalkAnimation starts automatically.

const rainbow = chalkAnimation.rainbow('Lorem ipsum'); // Animation starts

setTimeout(() => {
    rainbow.stop(); // Animation stops
}, 1000);

setTimeout(() => {
    rainbow.start(); // Animation resumes
}, 2000);

Automatic stop

Anything printed to the console will stop the previous animation automatically

chalkAnimation.rainbow('Lorem ipsum');
setTimeout(() => {
    // Stop the 'Lorem ipsum' animation, then write on a new line.
    console.log('dolor sit amet');
}, 1000);

Changing speed

Change the animation speed using a second parameter. Should be greater than 0, default is 1.

chalkAnimation.rainbow('Lorem ipsum', 2); // Two times faster than default

Changing text

Change the animated text seamlessly with replace()

let str = 'Loading...';
const rainbow = chalkAnimation.rainbow(str);

// Add a new dot every second
setInterval(() => {
    rainbow.replace(str += '.');
}, 1000);

Manual rendering

Manually render frames with render(), or get the content of the next frame with frame()

const rainbow = chalkAnimation.rainbow('Lorem ipsum').stop(); // Don't start the animation

rainbow.render(); // Display the first frame

const frame = rainbow.frame(); // Get the second frame
console.log(frame);

CLI mode

# Install package globally
$ npm install --global chalk-animation
$ chalk-animation --help

  Colorful animations in terminal output

  Usage
    $ chalk-animation <name> [options] [text...]

  Options
    --duration  Duration of the animation in ms, defaults to Infinity
    --speed  Animation speed as number > 0, defaults to 1

  Available animations
    rainbow
    pulse
    glitch
    radar
    neon
    karaoke

  Example
    $ chalk-animation rainbow Hello world!

Related

License

MIT © Boris K

Core symbols most depended-on inside this repo

animateString
called by 6
index.js
sleep
called by 3
test.js
stopLastAnimation
called by 2
index.js
rainbow
called by 0
index.js
pulse
called by 0
index.js
glitch
called by 0
index.js
radar
called by 0
index.js
neon
called by 0
index.js

Shape

Function 14

Languages

TypeScript100%

Modules by API surface

index.js13 symbols
test.js1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add chalk-animation \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact