GithubHelp home page GithubHelp logo

sindresorhus / figures Goto Github PK

View Code? Open in Web Editor NEW
584.0 13.0 23.0 99 KB

Unicode symbols with fallbacks for older terminals

License: MIT License

JavaScript 93.74% TypeScript 6.26%
unicode-symbols unicode terminal command-line-utility command-line node-module npm-package

figures's Introduction

figures

Unicode symbols with fallbacks for older terminals

and more...

Terminals such as Windows Console Host (and CMD) only support a limited character set.

Install

npm install figures

Usage

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

API

figures (default export)

Type: object

Symbols to use on any terminal.

mainSymbols

Symbols to use when the terminal supports Unicode symbols.

fallbackSymbols

Symbols to use when the terminal does not support Unicode symbols.

replaceSymbols(string, options?)

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.

string

Type: string

String where the Unicode symbols will be replaced with fallback symbols depending on the terminal.

options

Type: object

useFallback

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

Figures

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

Other characters

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.

Unsupported terminals

The following terminals are not officially supported:

  • xterm
  • Linux Terminal (kernel)
  • cmder

They can display most but not all of the symbols listed above.

Related

figures's People

Contributors

bendingbender avatar brandon93s avatar christophehurpeau avatar coreyfarrell avatar derhuerst avatar ehmicky avatar gibson042 avatar kevgo avatar richienb avatar samverschueren avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

figures's Issues

Support browsers?

Is there any possibility this library will get browser support?

The main thing preventing usage in the browser is this check in index.js:

const platform = process.platform;

Maybe it should be:

const platform = (function(){
    if(typeof process === 'object'){
        return process.platform || 'linux';
    }
    return 'linux'; //Maybe this should be something else.
})();

I don't know what else might need to be changed.

Expose the replacement function as a named export instead

Would there be some benefits to expose the replacement function as a named export instead of default export?

If so, should this be a breaking change (by removing the default export), or should this be backward-compatible (by keeping it)?

Add figures for some common mathematical symbols

What are your thoughts on adding figures for the following mathematical symbols?

≈ ≠ ≡ ≤ ≥ ∞

They display well on all environments:

Ubuntu 20.10, Gnome terminal:

unix_5

Windows 10, cmd.exe (CP850):

windows_5

I checked on macOS default terminal, and it looks good too 👍

Add figures for box lines

What are your thoughts on adding figures for box lines?

They display well on all environments. The following screenshots shows them both as individual characters, and displayed on several rows/columns.

Ubuntu 20.10, Gnome terminal:

unix_2

Windows 10, cmd.exe (CP850):

windows_2

I checked on macOS default terminal, and it looks good too 👍

I believe all of the above are useful, but offering a subset is also an option. The high number of characters is mostly due to different variants of dashes and boldness.

At the moment, the only related figure in this library is line (U-2500) (not included above).

Add figures for musical notes

What are your thoughts on adding figures for musical notes?

♪ ♫

They display well on all environments:

Ubuntu 20.10, Gnome terminal:

unix_4

Windows 10, cmd.exe (CP850):

windows_4

I checked on macOS default terminal, and it looks good too 👍

cmder support

cmder is a popular Windows terminal (22,000+ GitHub stars).

The following figures do not display correctly with its default font:

  • ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉
  • ▴ ▾ ◂ ▸
  • More than half of box drawing lines, including all horizontal/vertical dashed lines. The list here covers most of the lines supported by cmder.

Which solution would be better?

  1. Document lack of support for cmder
  2. Detect cmder using the CMDER_ROOT environment variable and provide a new set of fallback characters for it
  3. Fix the windows fallback for the above characters so they display correctly on cmder. This would impact all other Windows terminals, not only cmder.

empty space instead of tick symbol

Very strange bug in Mac OS 10.10 iTerm:

require('figures').tick
// produce empty symbol

I don't know why this happens, but it fixed with:

Object.keys(symbols).forEach(function(key) {
    symbols[key] = fromCharCode(symbols[key].charCodeAt(0));
});

Example:

var figures = require('figures');
var patchedFigures = require('../figures');

Object.keys(figures).forEach(function(key) {
    console.log('"%s" "%s"', patchedFigures[key], figures[key]);
});
// see screenshot below

screenshot

Transpile to ES5

I think it would be better if we can have this package distributed with ES5. Otherwise, this would break lots of packages that doesn't support ES6 new features like const.

Thanks

Main `cross` character is incorrect

(discovered while working on ava test result accessibility: avajs/ava#3082 )

The main cross character is U+2716 HEAVY MULTIPLICATION X "✖︎", but for accessibility (and proper contrast with tick U+2714 HEAVY CHECK MARK "✔︎") it should instead be U+2718 HEAVY BALLOT X "✘︎".

Add figures for triangles and lozenges

What are your thoughts on adding figures for triangles and lozenges?

They display well on all environments:

Ubuntu 20.10, Gnome terminal:

unix_3

Windows 10, cmd.exe (CP850):

windows_3

I checked on macOS default terminal, and it looks good too 👍

Note: this library is already having one triangle with the play figure, but it might be nice to have it as well as a regular "big triangle pointing to the right" figure.

Please consider exporting `main` & `windows`

I am trying to test the CLI of a cross-platform app that uses inquirer, which depends upon figures.

The issue is that tests fail with

  -       >( ) Pepperoni␊
  -        ( ) Ham␊
  -        ( ) Ground Meat␊
  -        ( ) Bacon␊
  +       ❯◯ Pepperoni␊
  +        ◯ Ham␊
  +        ◯ Ground Meat␊
  +        ◯ Bacon␊
            = The Cheeses = ␊
  -        (*) Mozzarella␊
  +        ◉ Mozzarella␊

The test can easily replace the output to have a normalized form of figures when CLI is being tested so this does not occur. However, currently, there is no programatic way to getting to the figures.windows symbols on my macos (or vice versa).

I can create a manual copy, but that seems brittle.

Add replacement method for automated tests

In automated tests, it is often a problem to have different outputs on Windows and Unix. In order to compare outputs, one would usually normalize outputs.

When using this module, for example, one would replace all (Unix) to (Windows), or the other way around.

This module provides with a replaceSymbols(string): string method, but it is not meant for this purpose.

figures/index.js

Lines 283 to 294 in b10ba98

// On terminals which do not support Unicode symbols, substitute them to other symbols
export const replaceSymbols = string => {
if (shouldUseMain) {
return string;
}
for (const [key, mainSymbol] of replacements) {
string = string.replaceAll(mainSymbol, fallbackSymbols[key]);
}
return string;
};

It would be nice to have another method (for example called forceFallbackSymbols(string): string, basically the same except without the initial shouldUseMain check. This could be used in automated tests.

What do you think?

Add documentation about all cross-platform terminal characters

I have run some code to print all Unicode codepoints from U-0000 to U-10fff on:

  • Ubuntu 20.10, Gnome terminal
  • macOS, default terminal
  • Windows 10, cmd.exe, CP850

The following characters appear to be the full list of characters correctly displayed in all of those environments:

0000-058f (most)
1d00-1fff (most)

2588 2593 2592 2591 2580 2584 25ac 25a0 25aa 25a1 25ab 258c 2590
█ ██ ▓ ▓▓ ▒ ▒▒ ░ ░░ ▀ ▀▀ ▄ ▄▄ ▬ ▬▬ ■ ■■ ▪ ▪▪ □ □□ ▫ ▫▫ ▌ ▌▌ ▐ ▐▐
  ██   ▓▓   ▒▒   ░░   ▀▀   ▄▄   ▬▬   ■■   ▪▪   □□   ▫▫   ▌▌   ▐▐

2500 2012 2014 2015 203e 2501 2550
─    ‒    —    ―    ‾    ━    ═
2504 2505 2508 2509 254c 254d 2212 2574 2013 2010 2578 2576 2043 257a 257c 257e
┄    ┅    ┈    ┉    ╌    ╍    −    ╴    –    ‐    ╸    ╶    ⁃    ╺    ╼    ╾
┄┄   ┅┅   ┈┈   ┉┉   ╌╌   ╍╍   −−   ╴╴   ––   ‐‐   ╸╸   ╶╶   ⁃⁃   ╺╺   ╼╼   ╾╾
2502 2503 2551 2016 2506 2507 250a 205e 250b 254e 254f 2575 2579 2577 257b 257d 257f
││   ┃┃   ║║   ‖‖   ┆┆   ┇┇   ┊┊   ⁞⁞   ┋┋   ╎╎   ╏╏   ╵╵   ╹╹   ╷╷   ╻╻   ╽╽   ╿╿
 │    ┃    ║    ‖    ┆    ┇    ┊    ⁞    ┋    ╎    ╏    ╵    ╹    ╷    ╻    ╽    ╿
250c 256d 250f 250d 250e 2554 2552 2553
┌    ╭    ┏    ┍    ┎    ╔    ╒    ╓
2510 256e 2513 2511 2512 2557 2555 2556
┐    ╮    ┓    ┑    ┒    ╗    ╕    ╖
2514 2570 2517 2515 2516 255a 2558 2559
└    ╰    ┗    ┕    ┖    ╚    ╘    ╙
2518 256f 251b 2519 251a 255d 255b 255c
┘    ╯    ┛    ┙    ┚    ╝    ╛    ╜
251c 2523 251d 251e 251f 2520 2521 2522 2560 255e 255f
├    ┣    ┝    ┞    ┟    ┠    ┡    ┢    ╠    ╞    ╟
2524 252b 2525 2526 2527 2528 2529 252a 2563 2561 2562
┤    ┫    ┥    ┦    ┧    ┨    ┩    ┪    ╣    ╡    ╢
252c 2533 252d 252e 252f 2530 2531 2532 2566 2564 2565
┬    ┳    ┭    ┮    ┯    ┰    ┱    ┲    ╦    ╤    ╥
2534 253b 2535 2536 2537 2538 2539 253a 2569 2567 2568
┴    ┻    ┵    ┶    ┷    ┸    ┹    ┺    ╩    ╧    ╨
253c 254b 253d 253e 253f 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 254a
┼    ╋    ┽    ┾    ┿    ╀    ╁    ╂    ╃    ╄    ╅    ╆    ╇    ╈    ╉    ╊
256c 256a 256b
╬    ╪    ╫
2573 2572 2571 2044 2215
╳    ╲     ╱    ⁄    ∕
      ╲   ╱    ⁄    ∕

2024 2219 2022 25e6 25cb 25cc 25cf
․    ∙    •    ◦    ○    ◌    ●
25b2 25b4 25b8 25ba 25bc 25be 25c2 25c4
▲    ▴    ▸    ►    ▼    ▾    ◂    ◄
2190 2191 2192 2193 2194 2195
←    ↑    →    ↓    ↔    ↕
2302 25ca 25d8 25d9
⌂    ◊    ◘    ◙

2018 2019 201a 201b 201c 201d 201e 201f 2032 2033 2e17 2039 203a
‘    ’    ‚    ‛    “    ”    „    ‟    ′    ″    ⸗    ‹    ›
2026 2030 203c 203d
…    ‰    ‼    ‽

2248 2260 2261 2264 2265
≈    ≠    ≡    ≤    ≥
2202 2206 220f 2211 221a 221e 221f 2229 222b 2310 2320 2321
∂    ∆    ∏    ∑    √    ∞    ∟    ∩    ∫    ⌐    ⌠    ⌡
2153 2154 2155 2156 2157 2158 2159 215a 215b 215c 215d 215e
⅓    ⅔    ⅕    ⅖    ⅗    ⅘    ⅙    ⅚    ⅛    ⅜    ⅝    ⅞
2070 2071 2074 2075 2076 2077 2078 2079 207a 207b 207c 207d 207e 207f
⁰    ⁱ    ⁴    ⁵    ⁶    ⁷    ⁸    ⁹    ⁺    ⁻    ⁼    ⁽    ⁾    ⁿ
2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 208a 208b 208c 208d 208e
₀    ₁    ₂    ₃    ₄    ₅    ₆    ₇    ₈    ₉    ₊    ₋    ₌    ₍    ₎
2090 2091 2092 2093 2094
ₐ    ₑ    ₒ    ₓ    ₔ

2020 2021 263a 263b 263c 2736 2640 2642 2660 2663 2665 2666 266a 266b 266f
†    ‡    ☺    ☻    ☼    ✶    ♀    ♂    ♠    ♣    ♥    ♦    ♪    ♫    ♯
2105 2113 2116 2117 2122 2126 212e 2132 214d 214e 2183 2184
℅    ℓ    №    ℗    ™    Ω    ℮    Ⅎ    ⅍    ⅎ    Ↄ    ↄ
20a0 20a1 20a2 20a3 20a4 20a5 20a6 20a7 20a8 20a9 20aa 20ab 20ac 20ad 20ae 20af
₠    ₡    ₢    ₣    ₤    ₥    ₦    ₧    ₨    ₩    ₪    ₫    €    ₭    ₮    ₯
20b0 20b1 20b2 20b3 20b4 20b5 20b6 20b7 20b8 20b9 20ba 20bd 20bf 0e3f
₰    ₱    ₲    ₳    ₴    ₵    ₶    ₷    ₸    ₹    ₺    ₽    ₿    ฿
2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 246a 246b 246c 246d 246e 246f
①    ②    ③    ④    ⑤    ⑥    ⑦    ⑧    ⑨    ⑩    ⑪    ⑫    ⑬    ⑭    ⑮    ⑯
2470 2471 2472 2473 24ea 24ef 24f0 24f1 24f2 24f3 24f4
⑰    ⑱    ⑲    ⑳    ⓪    ⓯    ⓰    ⓱    ⓲    ⓳    ⓴
24ff 2776 2777 2778 2779 277a 277b 277c 277d 277e 277f
⓿    ❶    ❷    ❸    ❹    ❺    ❻    ❼    ❽    ❾    ❿

2c60 2c61 2c62 2c63 2c64 2c65 2c66 2c67 2c68 2c69 2c6a 2c6b 2c6c 2c6d 2c6e 2c6f
Ⱡ    ⱡ    Ɫ    Ᵽ    Ɽ    ⱥ    ⱦ    Ⱨ    ⱨ    Ⱪ    ⱪ    Ⱬ    ⱬ    Ɑ    Ɱ    Ɐ
2c70 2c71 2c72 2c73 2c74 2c75 2c76 2c77 2c78 2c79 2c7a 2c7b 2c7c 2c7d 2c7e 2c7f
Ɒ    ⱱ    Ⱳ    ⱳ    ⱴ    Ⱶ    ⱶ    ⱷ    ⱸ    ⱹ    ⱺ    ⱻ    ⱼ    ⱽ    Ȿ    Ɀ
a717 a718 a719 a71a a71b a71c a71d a71e a71f a720 a721
ꜗ    ꜘ    ꜙ    ꜚ    ꜛ    ꜜ    ꜝ    ꜞ    ꜟ    ꜠    ꜡
a788 a789 a78a a78b a78c
ꞈ    ꞉    ꞊    Ꞌ    ꞌ
fb00 fb01 fb02 fb03 fb04 fb05 fb06
ff    fi    fl    ffi    ffl    ſt    st
fb13 fb14 fb15 fb16 fb17
ﬓ    ﬔ    ﬕ    ﬖ    ﬗ

Adding all of those would probably reduce the usability of this library by adding lots of useless characters.

However, I believe there might be some useful characters that could be added. I have opened #52, #53, #54, #55, #56, #57 for those. If there are some others you think might be interested that are not covered by those issues, please let me know and we can add issues for them. 👍

However, it might still be useful for some users to know the full extent of available cross-platform terminal characters. To do this, I am considering creating a repository with the symbols above, and link it at the end of this library's readme.md. Do you think this would be useful?

xterm support

xterm does not display the following figures correctly: ⬢ ⅐ ⅑ ⅒ ㋡ ෴ ❯ ⓧ Ⓘ ⓞ ⚠
Please note this is for xterm, not for xterm.js nor for Linux kernel console.

Which solution would be better?

  • Document lack of support for xterm
  • Detect xterm using the XTERM_VERSION environment variable and provide a new set of fallback characters for it

TypeError: Cannot read properties of undefined (reading 'tick')

when I try to run example , it hanppen a bug.

  • only run a fie -- index.js
  • NodeJS version is v16.17.0
  • npm version is 8.18.0

Code

import figures, {replaceSymbols, mainSymbols, fallbackSymbols} from 'figures';

console.log(figures.tick);
// On terminals with Unicode symbols:  ✔︎
// On other terminals:                 √

console.log(figures.mainSymbols.tick);
// On all terminals:  ✔︎

console.log(figures.fallbackSymbols.tick);
// On all terminals:  √

console.log(figures.replaceSymbols('✔︎ check'));
// On terminals with Unicode symbols:  ✔︎ check
// On other terminals:                 √ check`

Report bug

PS C:\Users\shish\code\command-tools> node ./bin/index.js
✔
file:///C:/Users/shish/code/command-tools/bin/index.js:7
console.log(figures.mainSymbols.tick);
                                ^

TypeError: Cannot read properties of undefined (reading 'tick')        
    at file:///C:/Users/shish/code/command-tools/bin/index.js:7:33     
    at ModuleJob.run (node:internal/modules/esm/module_job:193:25)     
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
    at async loadESM (node:internal/process/esm_loader:91:5)
    at async handleMainPromise (node:internal/modules/run_main:65:12)  `

Figures in PuTTY do not display correctly at all

I have two machines running Ubuntu with the same fonts/colors. One is Vagrant VM which I SSH into with PuTTY and the other is a regular laptop running the OS. When trying to use these figures within PuTTY they are either partially cut off or they are not displayed at all. Some fonts display them better than others but I am using Inconsolata for Powerline.

The laptop works great.

I don't really expect this to be fixed as it is a fringe case but was more or less wondering if someone was able to tweak some settings (in PuTTY, Ubuntu, etc) to get these to work?

checkboxCircle characters don't match

In my opinion checkboxCircleOn doesn't feel like an "on" state of checkboxCircleOff, I tried with Inquirer.js. For checkboxes circle/circleDotted and circleFilled look perfect, though those are meant for radio buttons, aren't they?

Add figures for subscript numbers

What are your thoughts on adding figures for subscript numbers? They display well on all environments:

Ubuntu 20.10, Gnome terminal:

unix_6

Windows 10, cmd.exe (CP850):

windows_6

I checked on macOS default terminal, and it looks good too 👍

Display single-character percentages on Windows

Most percentages single characters are available on Windows CP850. However, this library currently falls back to using ASCII such as 1/3.

Ubuntu 20.10 Gnome terminal:

unix_3

Windows 10 cmd.exe (CP850):

windows_3

However, 1/7, 1/9 and 1/10 are not supported on CP850.

Removing support for those three (arguably not-often-used) characters would allow switching to single characters percentages instead. This would also provide with a more consistent cross-platform experience.

What do you think?

Add list of figures in the readme

I'm not 100% sure, so didn't do a PR yet, because it might be too much.

It would be nice to have an overview of all the figures in the readme. Now you always have to dig into the code in order to see which symbols are supported.

Something like this might do

Name Real OSes Windows
tick ✔︎
cross ×
star *
...

Linux kernel console support

Approximately half of the figures do not display correctly in the Linux kernel console:

  • The following do not display correctly, but the windows fallback does: ✔ ℹ ⚠ ✖ ◼ ◯ ◉ ◌ ◎ ◉ ◯ ☒ ☐ ❯ △ ☰ ෴
  • The following do not display correctly, nor does the windows fallback (when there is one): ₀ ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ★ ✶ ㋡ ☺ ⬢ ♦ ◆ ♦ ◇ ◊ ◻ □ ▓ ▀ ▄ ▌ ▐ ⌂ ♥ ♪ ♫ ↔ ↕
  • Half of the line* figures do not display correctly (mostly the ones with mixed stroke styles)
  • All single-character percentages do not display correctly, except for ½ ¼ ¾

Which solution would be better?

  1. Document lack of support for the Linux kernel console
  2. Detect the Linux kernel console using the TERM=linux environment variable and provide a new set of fallback characters for it

(Please note that I tested this library on 22 terminals listed here. The only ones which did not work are the Linux kernel console, xterm and cmder. I have opened issues for each of those separately.)

symbols issues win7

Some of the symbols doesn't seems to be working on win ... e.g.

figures.tick produces V
figures.circleFilled produces ()
figures.circleCircle produces ( )
figures.bullet produces
...

etc.

Add figures for fill characters

What are your thoughts on adding figures for fill characters?

They display well on all environments. The following screenshots shows them both as individual characters, and displayed on several rows/columns.

Ubuntu 20.10, Gnome terminal:

unix_1

Windows 10, cmd.exe (CP850):

windows_1

On macOS default terminal, they do not combine perfectly vertically. I do not think there is a better character available though (but please let me know if I'm wrong). Also, many macOS users might have better terminal / fonts / settings which would show this better.

macos_1

I believe all of the above are useful:

  • The first 4 fill the whole character, which is good when "painting" a whole area, with 4 different shades
  • U-25a0 is useful for progress bar, as it has margins both up and down, but not left and right
  • The other 4 are useful as half-full characters: left, right, up, down

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.