figures
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "figures" npm package enables the usage of Unicode symbols with fallbacks for older terminals. This is achieved by providing a comprehensive list of main figures and their fallback alternatives, which prove useful for terminals with a limited character set like the Windows Console Host (CMD).
To utilize "figures", you first need to install the package by using the npm install command: npm install figures
. Once done, you can now import and make use of the various features provided by the package. The four primary exports are: figures (default export), mainSymbols, fallbackSymbols, and replaceSymbols function.
Here's basic code usage for all the primary exports:
import figures, {replaceSymbols, mainSymbols, fallbackSymbols} from 'figures';
console.log(figures.tick);
// Output will be "✔︎" on Unicode terminals, and "√" on other terminals
console.log(figures.mainSymbols.tick);
// Output will be "✔︎" on all terminals
console.log(figures.fallbackSymbols.tick);
// Output will be "√" on all terminals
console.log(figures.replaceSymbols('✔︎ check'));
// Output will be "✔︎ check" on Unicode terminals, and "√ check" on other terminals
The replaceSymbols function is used to replace Unicode symbols in a string according to the terminal's Unicode support.
The entire documentation for "figures", including information about all the symbols it supports, can be found in the readme content of the package's GitHub repository. Furthermore, for a comprehensive list of cross-platform terminal characters, you can refer to this resource.