All Projects → khrome → Ascii Art

khrome / Ascii Art

Licence: mit
A Node.js library for ansi codes, figlet fonts, ascii art and other ASCII graphics

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ascii Art

Boxes
Command line ASCII boxes unlimited!
Stars: ✭ 398 (-8.92%)
Mutual labels:  ascii, ascii-art
figlet4s
ASCII-art banners in Scala
Stars: ✭ 29 (-93.36%)
Mutual labels:  ascii, ascii-art
asciisciit
ASCII Art, Video, and Plotting Toolbox
Stars: ✭ 71 (-83.75%)
Mutual labels:  ascii, ascii-art
How-to-use-Readline-in-NodeJS
⌨️ How to manipulate the terminal window using NodeJS
Stars: ✭ 20 (-95.42%)
Mutual labels:  ascii, ascii-art
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (-32.27%)
Mutual labels:  ascii, ascii-art
aart
Convert images and video to ascii art!
Stars: ✭ 18 (-95.88%)
Mutual labels:  images, ascii-art
Figlet Fonts
my collection of figlet / toilet ascii art fonts
Stars: ✭ 393 (-10.07%)
Mutual labels:  ascii, ascii-art
ascii-art
ASCII art images for Neofetch (and beyond)
Stars: ✭ 27 (-93.82%)
Mutual labels:  ascii, ascii-art
hasciicam
(h)ascii for the masses! html refreshed ascii video cam
Stars: ✭ 63 (-85.58%)
Mutual labels:  ascii, ascii-art
lexicon-mono-seq
DOM Text Based Multiple Sequence Alignment Library
Stars: ✭ 15 (-96.57%)
Mutual labels:  ascii, ascii-art
ascii-art
Given a image.bmp and a M x N group of pixels, generate a text that represents the image.bmp in ascii characters
Stars: ✭ 16 (-96.34%)
Mutual labels:  ascii, ascii-art
Imgtoascii
A JavaScript implementation of a image to Ascii code
Stars: ✭ 331 (-24.26%)
Mutual labels:  ascii, ascii-art
jpgtxt
Generating jpg files that can be viewed both in image viewer and text editor (as ASCII art)
Stars: ✭ 24 (-94.51%)
Mutual labels:  ascii, ascii-art
durdraw
Animated Unicode, ANSI and ASCII Art Editor for Linux/Unix/macOS
Stars: ✭ 55 (-87.41%)
Mutual labels:  ascii, ascii-art
asciju
Conversion of Image, video, text into ASCII format
Stars: ✭ 11 (-97.48%)
Mutual labels:  ascii, ascii-art
gifterm
View animated .GIF files in a text console. Linux/Mac/Windows
Stars: ✭ 14 (-96.8%)
Mutual labels:  ascii, ascii-art
outfancy
Python3 library to print tables in Terminal.
Stars: ✭ 47 (-89.24%)
Mutual labels:  ascii, ascii-art
magrrite
Generate ASCII art from any image
Stars: ✭ 21 (-95.19%)
Mutual labels:  ascii, ascii-art
ascii chart
Nice-looking lightweight console ASCII line charts ╭┈╯. Port of kroitor/asciichart.
Stars: ✭ 24 (-94.51%)
Mutual labels:  ascii, ascii-art
Tart
Tart - draw ASCII art in the terminal with your mouse!
Stars: ✭ 296 (-32.27%)
Mutual labels:  ascii, ascii-art
                   _  _                       _
                  (_)(_)                     | |
  __ _  ___   ___  _  _  ______   __ _  _ __ | |_
 / _` |/ __| / __|| || ||______| / _` || '__|| __|
| (_| |\__ \| (__ | || |        | (_| || |   | |_
 \__,_||___/ \___||_||_|         \__,_||_|    \__|

ascii-art.js

NPM version npm Travis GitHub stars

Images, fonts, tables, ansi styles and compositing in Node.js & the browser. 100% JS. (What is ASCII-Art?)

In the beginning there was colors.js but in the fine tradition of vendors calling out a problem they have the solution to, chalk was introduced. In that same vein, I offer ascii-art as an update, expansion and generalization of MooAsciiArt and at the same time it can replace your existing ansi colors library.

It features support for Images, Styles, Tables, Graphs and Figlet Fonts as well as handling multi-line joining and compositing automatically.

Why would I use this?

  • modular - small set of purpose built modules all interacting through a common ansi library.
  • color profiles support - other libraries assume you are running x11
  • no prototype manipulation - No String.prototype usage. No __proto__ usage. No BS.
  • handles the ugly intersection of multiline text and ansi codes for you.
  • runs in the browser and Node.js (CommonJS, AMD, globals or webpack)
  • JS + Canvas Ascii image generation utilities in node don't actually touch any pixels, but usually call out to a binary, we do 100% of our transform in JS, which allows us plug into averaging, distance and other logic dynamically, in powerful ways.
  • It works like a package manager for figlet fonts.
  • The other libraries out there do too little, focus on logging above other domains and often unaware of ANSI controls(for example: style text, then put it in a table).
  • Supports your existing API We allow you to use the colors.js/chalk API or our own (where we reserve chaining for utility rather than code aesthetics).
  • flexible output Supports 4bit, 8bit and 32bit output

Installation

npm install ascii-art

If you'd like to use the command-line tool make sure to use -g

If you want to use .image() or .Image you must install canvas and if you want to run the chalk tests... you'll need to to install require-uncached as well.

Styles

Add ANSI styles to a string and return the result.

In your code In the Terminal
.style(text, style[, close]) > String ascii-art text -s green "some text"

Styles are: italic, bold, underline, |framed|, |encircled|, overline, blink and  inverse . And available colors are:

Colors

Color defaults to 8 bit (most compatible), to enable other modes set booleans in the options:

  • is256 : compute the color using 256colors, as defined by ansi256. Note that full color output may need to tune the difference method to obtain optimal results.
  • isTrueColor : do not constrain color and directly output RGB to the console.

Color Tables may be found in the style documentation

Fonts

Render a string using a figlet font and add that to the buffer. There is a batch version of this function which does not chain and takes an array( .strings()).

In your code In the Terminal
.font(text, font[, style][, callback]) ascii-art text -F <font> "Demo!"

Outputs

______                          _
|  _  \                        | |
| | | |  ___  _ __ ___    ___  | |
| | | | / _ \| '_ ` _ \  / _ \ | |
| |/ / |  __/| | | | | || (_) ||_|
|___/   \___||_| |_| |_| \___/ (_)

If you use UTF fonts your output looks more like:

Mucha Lineart

or

Mucha Lineart

Check out the documentation for more examples!

Images

Create an image from the passed image and append that to the buffer

In your code In the Terminal
.image(options[, callback]) ascii-art image path/to/my/file.jpg

There are 2 options that are available which are not in the image core, they are:

  • lineart : a boolean option which outputs lineart using block characters (which may be colored with stroke and customized with threshold(0-255))
  • stipple : a boolean option which outputs lineart using braille characters (which may be colored with stroke and customized with threshold(0-255))
  • posterize : use lineart on top of colored backgrounds to retain as much detail as possible

Because of the resolution downsampling, some finer details may be lost. Plan accordingly. Here's an example in 256 color (primarily greyscale):

ascii-art image -B 8 -C rankedChannel -a blocks node_modules/ascii-art/Images/grendel.jpg

Grendel Compare

Here's an example of lineart output:

Mucha Stipple

Here's an example of posterize output:

Peewee Lineart

Here's a comparison of various color output modes:

Zero Cool Compare

	#4bit
	ascii-art image -B 4 -a solid node_modules/ascii-art/Images/zero-cool.jpg

	#8bit
	ascii-art image -B 8 -C closestByIntensity -a solid node_modules/ascii-art/Images/zero-cool.jpg

	#32bit (on supported terminals)
	ascii-art image -B 32 -a solid node_modules/ascii-art/Images/zero-cool.jpg

Check out the documentation for more examples!

Tables

Generate a table from the passed data, with support for many styles and append that to the buffer

In your code In the Terminal
.table(options[, callback]) N/A

Styled Table Example

Check out the documentation for more examples!

Graphs

Generate a graph from the passed data

In your code In the Terminal
.graph(options[, callback]) N/A

Graph Example

Check out the documentation for more examples!

Artwork

fetch a graphic from a remote source and append it to the current buffer.

In your code In the Terminal
.artwork(options[, callback]) ascii-art art [source][/path]

Often I use this in conjunction with an image backdrop, for example to superimpose bones on the earth:

Mixed Content Example

Compositing

We also support combining all these nifty elements you've made into a single composition, via a few functions available on the chains (.lines(), .overlay(), .border() and .join()). Maybe I've got A BBS wall I want to have some dynamic info on.. I could make that with this

Mixed Content Example

Check out the documentation for detailed examples!

Promises

Instead of providing a callback, you can also get a from the top level by calling then which lazily produces a promise, or you can use the old function, which is deprecated ( .toPromise()).

In your code
.font(text, font[, style]).then(handler).catch(errHandler)

Compatibility

If you're a chalk user, just use var chalk = require('ascii-art/kaolin'); in place of your existing chalk references (Much of color.js, too... since chalk is a subset of colors.js). No migration needed, keep using the wacky syntax you are used to(In this mode, refer to their docs, not mine).

Users of ascii-table will also note that interface is supported via require('ascii-art').Table, though our solution is ansi-aware, lazy rendering and better at sizing columns.

I may support the other colors stuff (extras & themes) eventually, but it's currently a low priority.

Roadmap

Goals

  • Better Docs
  • value reversal (light vs dark)
  • HTML output
  • piping support on the command line
  • ATASCII art support
  • ANSI art support
  • PETSCII art support
  • 2 colors per char with multisampling
  • REPL

Non Goals

  • realtime: videos, curses, etc.:
  • logging integration

Testing

In the root directory run:

npm run test

which runs the test suite directly. In order to test it in Chrome try:

npm run browser-test

In order to run the chalk test, use:

npm run chalk-test

Please make sure to run the tests before submitting a patch and report any rough edges. Thanks!

Enjoy,

-Abbey Hawk Sparrow

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].