Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
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.
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);
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.
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.
Unicode symbols with fallbacks for older terminals
Terminals such as Windows Console Host (and CMD) only support a limited character set.
npm install figures
import figures, {mainSymbols, fallbackSymbols, replaceSymbols} from 'figures';
console.log(figures.tick);
// On terminals with Unicode symbols: ✔
// On other terminals: √
console.log(mainSymbols.tick);
// On all terminals: ✔
console.log(fallbackSymbols.tick);
// On all terminals: √
console.log(replaceSymbols('✔ check'));
// On terminals with Unicode symbols: ✔ check
// On other terminals: √ check
Type: object
Symbols to use on any terminal.
Symbols to use when the terminal supports Unicode symbols.
Symbols to use when the terminal does not support Unicode symbols.
Returns the input with replaced fallback symbols if the terminal has poor Unicode support.
All the below figures are attached to the default export as shown in the example above.
Type: string
String where the Unicode symbols will be replaced with fallback symbols depending on the terminal.
Type: object
Type: boolean
Default: true
if the terminal has poor Unicode support
Whether to replace symbols with fallbacks.
This can be set to true
to always use fallback symbols, whether the terminal has poor Unicode support or not.
import {replaceSymbols} from 'figures';
console.log(replaceSymbols('✔ check', {useFallback: true}));
// On terminals with Unicode symbols: √ check
// On other terminals: √ check
Fallback
characters are only shown when they differ from the Main
ones.
Name | Main | Fallback |
---|---|---|
tick | ✔ | √ |
info | ℹ | i |
warning | ⚠ | ‼ |
cross | ✘ | × |
square | █ | |
squareSmall | ◻ | □ |
squareSmallFilled | ◼ | ■ |
squareDarkShade | ▓ | |
squareMediumShade | ▒ | |
squareLightShade | ░ | |
squareTop | ▀ | |
squareBottom | ▄ | |
squareLeft | ▌ | |
squareRight | ▐ | |
squareCenter | ■ | |
circle | ◯ | ( ) |
circleFilled | ◉ | (*) |
circleDotted | ◌ | ( ) |
circleDouble | ◎ | ( ) |
circleCircle | ⓞ | (○) |
circleCross | ⓧ | (×) |
circlePipe | Ⓘ | (│) |
circleQuestionMark | ?⃝ | (?) |
radioOn | ◉ | (*) |
radioOff | ◯ | ( ) |
checkboxOn | ☒ | [×] |
checkboxOff | ☐ | [ ] |
checkboxCircleOn | ⓧ | (×) |
checkboxCircleOff | Ⓘ | ( ) |
questionMarkPrefix | ?⃝ | ? |
bullet | ● | |
dot | ․ | |
ellipsis | … | |
pointer | ❯ | > |
pointerSmall | › | › |
triangleUp | ▲ | |
triangleUpSmall | ▴ | |
triangleUpOutline | △ | ∆ |
triangleDown | ▼ | |
triangleDownSmall | ▾ | |
triangleLeft | ◀ | ◄ |
triangleLeftSmall | ◂ | |
triangleRight | ▶ | ► |
triangleRightSmall | ▸ | |
lozenge | ◆ | ♦ |
lozengeOutline | ◇ | ◊ |
home | ⌂ | |
hamburger | ☰ | ≡ |
smiley | ㋡ | ☺ |
mustache | ෴ | ┌─┐ |
heart | ♥ | |
star | ★ | ✶ |
play | ▶ | ► |
musicNote | ♪ | |
musicNoteBeamed | ♫ | |
nodejs | ⬢ | ♦ |
arrowUp | ↑ | |
arrowDown | ↓ | |
arrowLeft | ← | |
arrowRight | → | |
arrowLeftRight | ↔ | |
arrowUpDown | ↕ | |
almostEqual | ≈ | |
notEqual | ≠ | |
lessOrEqual | ≤ | |
greaterOrEqual | ≥ | |
identical | ≡ | |
infinity | ∞ | |
subscriptZero | ₀ | |
subscriptOne | ₁ | |
subscriptTwo | ₂ | |
subscriptThree | ₃ | |
subscriptFour | ₄ | |
subscriptFive | ₅ | |
subscriptSix | ₆ | |
subscriptSeven | ₇ | |
subscriptEight | ₈ | |
subscriptNine | ₉ | |
oneHalf | ½ | |
oneThird | ⅓ | |
oneQuarter | ¼ | |
oneFifth | ⅕ | |
oneSixth | ⅙ | |
oneSeventh | ⅐ | 1/7 |
oneEighth | ⅛ | |
oneNinth | ⅑ | 1/9 |
oneTenth | ⅒ | 1/10 |
twoThirds | ⅔ | |
twoFifths | ⅖ | |
threeQuarters | ¾ | |
threeFifths | ⅗ | |
threeEighths | ⅜ | |
fourFifths | ⅘ | |
fiveSixths | ⅚ | |
fiveEighths | ⅝ | |
sevenEighths | ⅞ | |
line | ─ | |
lineBold | ━ | |
lineDouble | ═ | |
lineDashed0 | ┄ | |
lineDashed1 | ┅ | |
lineDashed2 | ┈ | |
lineDashed3 | ┉ | |
lineDashed4 | ╌ | |
lineDashed5 | ╍ | |
lineDashed6 | ╴ | |
lineDashed7 | ╶ | |
lineDashed8 | ╸ | |
lineDashed9 | ╺ | |
lineDashed10 | ╼ | |
lineDashed11 | ╾ | |
lineDashed12 | − | |
lineDashed13 | – | |
lineDashed14 | ‐ | |
lineDashed15 | ⁃ | |
lineVertical | │ | |
lineVerticalBold | ┃ | |
lineVerticalDouble | ║ | |
lineVerticalDashed0 | ┆ | |
lineVerticalDashed1 | ┇ | |
lineVerticalDashed2 | ┊ | |
lineVerticalDashed3 | ┋ | |
lineVerticalDashed4 | ╎ | |
lineVerticalDashed5 | ╏ | |
lineVerticalDashed6 | ╵ | |
lineVerticalDashed7 | ╷ | |
lineVerticalDashed8 | ╹ | |
lineVerticalDashed9 | ╻ | |
lineVerticalDashed10 | ╽ | |
lineVerticalDashed11 | ╿ | |
lineDownLeft | ┐ | |
lineDownLeftArc | ╮ | |
lineDownBoldLeftBold | ┓ | |
lineDownBoldLeft | ┒ | |
lineDownLeftBold | ┑ | |
lineDownDoubleLeftDouble | ╗ | |
lineDownDoubleLeft | ╖ | |
lineDownLeftDouble | ╕ | |
lineDownRight | ┌ | |
lineDownRightArc | ╭ | |
lineDownBoldRightBold | ┏ | |
lineDownBoldRight | ┎ | |
lineDownRightBold | ┍ | |
lineDownDoubleRightDouble | ╔ | |
lineDownDoubleRight | ╓ | |
lineDownRightDouble | ╒ | |
lineUpLeft | ┘ | |
lineUpLeftArc | ╯ | |
lineUpBoldLeftBold | ┛ | |
lineUpBoldLeft | ┚ | |
lineUpLeftBold | ┙ | |
lineUpDoubleLeftDouble | ╝ | |
lineUpDoubleLeft | ╜ | |
lineUpLeftDouble | ╛ | |
lineUpRight | └ | |
lineUpRightArc | ╰ | |
lineUpBoldRightBold | ┗ | |
lineUpBoldRight | ┖ | |
lineUpRightBold | ┕ | |
lineUpDoubleRightDouble | ╚ | |
lineUpDoubleRight | ╙ | |
lineUpRightDouble | ╘ | |
lineUpDownLeft | ┤ | |
lineUpBoldDownBoldLeftBold | ┫ | |
lineUpBoldDownBoldLeft | ┨ | |
lineUpDownLeftBold | ┥ | |
lineUpBoldDownLeftBold | ┩ | |
lineUpDownBoldLeftBold | ┪ | |
lineUpDownBoldLeft | ┧ | |
lineUpBoldDownLeft | ┦ | |
lineUpDoubleDownDoubleLeftDouble | ╣ | |
lineUpDoubleDownDoubleLeft | ╢ | |
lineUpDownLeftDouble | ╡ | |
lineUpDownRight | ├ | |
lineUpBoldDownBoldRightBold | ┣ | |
lineUpBoldDownBoldRight | ┠ | |
lineUpDownRightBold | ┝ | |
lineUpBoldDownRightBold | ┡ | |
lineUpDownBoldRightBold | ┢ | |
lineUpDownBoldRight | ┟ | |
lineUpBoldDownRight | ┞ | |
lineUpDoubleDownDoubleRightDouble | ╠ | |
lineUpDoubleDownDoubleRight | ╟ | |
lineUpDownRightDouble | ╞ | |
lineDownLeftRight | ┬ | |
lineDownBoldLeftBoldRightBold | ┳ | |
lineDownLeftBoldRightBold | ┯ | |
lineDownBoldLeftRight | ┰ | |
lineDownBoldLeftBoldRight | ┱ | |
lineDownBoldLeftRightBold | ┲ | |
lineDownLeftRightBold | ┮ | |
lineDownLeftBoldRight | ┭ | |
lineDownDoubleLeftDoubleRightDouble | ╦ | |
lineDownDoubleLeftRight | ╥ | |
lineDownLeftDoubleRightDouble | ╤ | |
lineUpLeftRight | ┴ | |
lineUpBoldLeftBoldRightBold | ┻ | |
lineUpLeftBoldRightBold | ┷ | |
lineUpBoldLeftRight | ┸ | |
lineUpBoldLeftBoldRight | ┹ | |
lineUpBoldLeftRightBold | ┺ | |
lineUpLeftRightBold | ┶ | |
lineUpLeftBoldRight | ┵ | |
lineUpDoubleLeftDoubleRightDouble | ╩ | |
lineUpDoubleLeftRight | ╨ | |
lineUpLeftDoubleRightDouble | ╧ | |
lineUpDownLeftRight | ┼ | |
lineUpBoldDownBoldLeftBoldRightBold | ╋ | |
lineUpDownBoldLeftBoldRightBold | ╈ | |
lineUpBoldDownLeftBoldRightBold | ╇ | |
lineUpBoldDownBoldLeftRightBold | ╊ | |
lineUpBoldDownBoldLeftBoldRight | ╉ | |
lineUpBoldDownLeftRight | ╀ | |
lineUpDownBoldLeftRight | ╁ | |
lineUpDownLeftBoldRight | ┽ | |
lineUpDownLeftRightBold | ┾ | |
lineUpBoldDownBoldLeftRight | ╂ | |
lineUpDownLeftBoldRightBold | ┿ | |
lineUpBoldDownLeftBoldRight | ╃ | |
lineUpBoldDownLeftRightBold | ╄ | |
lineUpDownBoldLeftBoldRight | ╅ | |
lineUpDownBoldLeftRightBold | ╆ | |
lineUpDoubleDownDoubleLeftDoubleRightDouble | ╬ | |
lineUpDoubleDownDoubleLeftRight | ╫ | |
lineUpDownLeftDoubleRightDouble | ╪ | |
lineCross | ╳ | |
lineBackslash | ╲ | |
lineSlash | ╱ |
If you cannot find the character you're looking for in the table above, please look at this full list of cross-platform terminal characters.
The following terminals are not officially supported:
They can display most but not all of the symbols listed above.
FAQs
Unicode symbols with fallbacks for older terminals
The npm package figures receives a total of 27,938,160 weekly downloads. As such, figures popularity was classified as popular.
We found that figures demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.