ASCII arts
The tiny useless art console library
ASCII Printer
Print colorful ASCII arts in the JavaScript console.
AsciiPrinter.printByName("fox")
Tags
KB file size
Current version
GitHub
Get started
Load one file and start printing
This demo page loads the minified build first, then the page script. Your own page only needs the build file.
Use the minified build
<script src="build/ascii-printer.min.js"></script>
Call the API
AsciiPrinter.printByName("pinkPanther");
AsciiPrinter.printRandom("bird");
AsciiPrinter.printRandomFrom(["heart", "key", "lightBulb"]);
AsciiPrinter.listNames("bird");
AsciiPrinter.version;
Documentation
What's inside?
Print methods write ASCII art to the console. List methods return collections. Get methods return one catalog entry without printing.
| API | Description |
|---|---|
AsciiPrinter.printById() |
Prints one ASCII by ID. |
AsciiPrinter.printByName() |
Prints one ASCII by exact name. |
AsciiPrinter.printBySearch() |
Prints the first ASCII whose name contains the search text. |
AsciiPrinter.printRandom() |
Prints a random ASCII, optionally filtered by tag. |
AsciiPrinter.printRandomFrom() |
Prints a random ASCII from a list of names. |
AsciiPrinter.listTags() |
Returns the available tags. |
AsciiPrinter.listNames() |
Returns ASCII names, optionally filtered by tag. |
AsciiPrinter.list() |
Returns ASCII metadata with id, name, and tags.
|
AsciiPrinter.getById() |
Returns one ASCII by ID without printing it. |
AsciiPrinter.getByName() |
Returns one ASCII by exact name without printing it. |
AsciiPrinter.version |
Returns the library version. |
AsciiPrinter.catalog |
Returns the full ASCII catalog. |
Print by name
AsciiPrinter.printByName(name, options)
AsciiPrinter.printByName("bigBird");
Print by ID
AsciiPrinter.printById(id, options)
AsciiPrinter.printById(94);
IDs are catalog indexes and can change when the library is reordered.
Print by search
AsciiPrinter.printBySearch(query, options)
AsciiPrinter.printBySearch("panther");
Search prints the first ASCII whose name contains the query.
Print random
AsciiPrinter.printRandom(tag, options)
AsciiPrinter.printRandom();
AsciiPrinter.printRandom("bird");
The tag parameter is optional. If no ASCII matches the tag, the full catalog is used.
Print random from names
AsciiPrinter.printRandomFrom(names, options)
AsciiPrinter.printRandomFrom([
"heart",
"key",
"lightBulb"
]);
Unknown names are ignored. If nothing matches, ASCII Printer prints a warning.
Print options
All print methods accept the same optional object.
AsciiPrinter.printByName("frog", {
color: "HotPink"
});
AsciiPrinter.printByName("frog", {
color: false,
credits: true
});
color- Overrides the catalog color with any browser-supported CSS color. Use
falseto keep the console default. credits- Prints the ASCII author after the art. Unknown authors display as
Unknown.
List
List tags
AsciiPrinter.listTags()
AsciiPrinter.listTags();
List names
AsciiPrinter.listNames(tag)
AsciiPrinter.listNames();
AsciiPrinter.listNames("bird");
List metadata
AsciiPrinter.list(tag)
AsciiPrinter.list();
AsciiPrinter.list("bird");
Get
Get by name
AsciiPrinter.getByName(name)
AsciiPrinter.getByName("frog");
Get by ID
AsciiPrinter.getById(id)
AsciiPrinter.getById(59);
Catalog data
Version
AsciiPrinter.version;
Full catalog
AsciiPrinter.catalog;
Each catalog entry contains name, tags, art,
color, height, and author.
Project files
Build files
The readable and minified builds are generated manually from source. AsciiPrinter is the only exposed global.
build/ascii-printer.js
build/ascii-printer.min.js
Playground
Pick one and print it
hello
message · 4 lines · Unknown
Catalog
All the arts contained in the file
| ID | Name | Tags | Color | Height | Author | Command |
|---|