What is figures?
The figures npm package provides a set of unicode symbols with fallbacks to ASCII characters for better compatibility across different platforms. It allows developers to enhance the visual appeal and readability of their console output without worrying about cross-platform issues.
What are figures's main functionalities?
Cross-platform symbols
This feature allows the use of symbols like ticks and crosses, with automatic fallbacks to simpler ASCII characters on platforms that do not support the more complex unicode symbols. The code sample demonstrates how to use the tick and cross symbols.
"use strict";\nconst figures = require('figures');\nconsole.log(figures.tick, figures.cross);
Customizable symbol fallbacks
Developers can customize the fallbacks for symbols, providing an alternative character for environments that do not support the default unicode symbol. This code sample shows how to replace the default tick symbol with a custom character.
"use strict";\nconst figures = require('figures');\nfigures.replace({ tick: '√' });\nconsole.log(figures.tick);
Other packages similar to figures
chalk
Chalk is a popular npm package for styling terminal strings. While it focuses on adding color and style to text, figures focuses on providing cross-platform symbols. Both packages enhance the visual output of console applications but in different aspects.
emoji
The emoji package allows for the inclusion of emojis in Node.js applications. Similar to figures, it enhances the visual aspect of console output but does so through emojis rather than symbols. Figures provides a more subtle way of enhancing output with symbols that have fallbacks for better compatibility.
figures
Unicode symbols with Windows CMD fallbacks
Windows CMD only supports a limited character set.
Install
$ npm install --save figures
Usage
See the source for supported symbols.
var figures = require('figures');
console.log(figures.tick);
License
MIT © Sindre Sorhus