Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

TorchedArchive/AnsiKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnsiKit

🎨 The ultimate terminal ANSI kit.



AnsiKit is a small and simple library for setting attributes and reading information about a terminal. It is very convenient due to having a consistent API and coverage for every sensible ANSI code.

AnsiKit simply prints escapes to the terminal for the user, but also results in cleaner looking code.
Note: If a terminal is not xterm-compatible some functions may not work as intended or just won't work at all.
(For example the standard Windows `cmd`, but Windows Terminal should have better results.)

Table of Contents

Install

npm install ansikit

Example

const ansikit = require('ansikit');

// The format function takes color tags and replaces it with color codes.
const text = ansikit.format('{underline}Hello {red}world!');
console.log(text);

Styles

A style can be used in a format function like: {style} for example {bold}.

Modifiers

reset
bold
bold-off
dim or faint
italic
underline
underline-off
invert or reverse
strike or strikethrough

Colors

black
red
green
yellow
blue
magenta
cyan
white

black-bg
red-bg
green-bg
yellow-bg
blue-bg
magenta-bg
cyan-bg
white-bg

bright-black or grey or gray
bright-red
bright-green
bright-yellow
bright-blue
bright-magenta
bright-cyan

Links

Contributing

If you would like to contribute, be sure to:

  • Lint with our ESLint config
  • Add JSDoc (if adding a new function)

And make a pull request!

Developing

git clone https://github.com/Luvella/AnsiKit
cd AnsiKit
npm i
npm i eslint -g # For linting (if you don't have it installed)
# After making changes:
eslint lib/

If you aren't contributing code you can always open an issue.

License

AnsiKit is licensed under the MIT license.
Read here for more info.

FOSSA Status