1 | # figures [![Build Status](https://travis-ci.org/sindresorhus/figures.svg?branch=master)](https://travis-ci.org/sindresorhus/figures)
|
---|
2 |
|
---|
3 | > Unicode symbols with Windows CMD fallbacks
|
---|
4 |
|
---|
5 | [![](screenshot.png)](index.js)
|
---|
6 |
|
---|
7 | [*and more...*](index.js)
|
---|
8 |
|
---|
9 | Windows CMD only supports a [limited character set](http://en.wikipedia.org/wiki/Code_page_437).
|
---|
10 |
|
---|
11 | ## Install
|
---|
12 |
|
---|
13 | ```
|
---|
14 | $ npm install figures
|
---|
15 | ```
|
---|
16 |
|
---|
17 | ## Usage
|
---|
18 |
|
---|
19 | See the [source](index.js) for supported symbols.
|
---|
20 |
|
---|
21 | ```js
|
---|
22 | const figures = require('figures');
|
---|
23 |
|
---|
24 | console.log(figures('✔︎ check'));
|
---|
25 | // On non-Windows OSes: ✔︎ check
|
---|
26 | // On Windows: √ check
|
---|
27 |
|
---|
28 | console.log(figures.tick);
|
---|
29 | // On non-Windows OSes: ✔︎
|
---|
30 | // On Windows: √
|
---|
31 |
|
---|
32 | console.log(figures.main.tick);
|
---|
33 | // On all OSes: ✔︎
|
---|
34 |
|
---|
35 | console.log(figures.windows.tick);
|
---|
36 | // On all OSes: √
|
---|
37 | ```
|
---|
38 |
|
---|
39 | ## API
|
---|
40 |
|
---|
41 | ### figures(string)
|
---|
42 |
|
---|
43 | Returns the input with replaced fallback Unicode symbols on Windows.
|
---|
44 |
|
---|
45 | All the below [figures](#figures) are attached to the main export as shown in the example above.
|
---|
46 |
|
---|
47 | #### string
|
---|
48 |
|
---|
49 | Type: `string`
|
---|
50 |
|
---|
51 | String where the Unicode symbols will be replaced with fallback symbols depending on the OS.
|
---|
52 |
|
---|
53 | ### figures.main
|
---|
54 |
|
---|
55 | Symbols to use when not running on Windows.
|
---|
56 |
|
---|
57 | ### figures.windows
|
---|
58 |
|
---|
59 | Symbols to use when running on Windows.
|
---|
60 |
|
---|
61 |
|
---|
62 | ## Figures
|
---|
63 |
|
---|
64 | | Name | Non-Windows | Windows |
|
---|
65 | | ------------------ | :---------: | :-----: |
|
---|
66 | | tick | ✔ | √ |
|
---|
67 | | cross | ✖ | × |
|
---|
68 | | star | ★ | * |
|
---|
69 | | square | ▇ | █ |
|
---|
70 | | squareSmall | ◻ | [ ] |
|
---|
71 | | squareSmallFilled | ◼ | [█] |
|
---|
72 | | play | ▶ | ► |
|
---|
73 | | circle | ◯ | ( ) |
|
---|
74 | | circleFilled | ◉ | (*) |
|
---|
75 | | circleDotted | ◌ | ( ) |
|
---|
76 | | circleDouble | ◎ | ( ) |
|
---|
77 | | circleCircle | ⓞ | (○) |
|
---|
78 | | circleCross | ⓧ | (×) |
|
---|
79 | | circlePipe | Ⓘ | (│) |
|
---|
80 | | circleQuestionMark | ?⃝ | (?) |
|
---|
81 | | bullet | ● | * |
|
---|
82 | | dot | ․ | . |
|
---|
83 | | line | ─ | ─ |
|
---|
84 | | ellipsis | … | ... |
|
---|
85 | | pointer | ❯ | > |
|
---|
86 | | pointerSmall | › | » |
|
---|
87 | | info | ℹ | i |
|
---|
88 | | warning | ⚠ | ‼ |
|
---|
89 | | hamburger | ☰ | ≡ |
|
---|
90 | | smiley | ㋡ | ☺ |
|
---|
91 | | mustache | ෴ | ┌─┐ |
|
---|
92 | | heart | ♥ | ♥ |
|
---|
93 | | nodejs | ⬢ | ♦ |
|
---|
94 | | arrowUp | ↑ | ↑ |
|
---|
95 | | arrowDown | ↓ | ↓ |
|
---|
96 | | arrowLeft | ← | ← |
|
---|
97 | | arrowRight | → | → |
|
---|
98 | | radioOn | ◉ | (*) |
|
---|
99 | | radioOff | ◯ | ( ) |
|
---|
100 | | checkboxOn | ☒ | [×] |
|
---|
101 | | checkboxOff | ☐ | [ ] |
|
---|
102 | | checkboxCircleOn | ⓧ | (×) |
|
---|
103 | | checkboxCircleOff | Ⓘ | ( ) |
|
---|
104 | | questionMarkPrefix | ?⃝ | ? |
|
---|
105 | | oneHalf | ½ | 1/2 |
|
---|
106 | | oneThird | ⅓ | 1/3 |
|
---|
107 | | oneQuarter | ¼ | 1/4 |
|
---|
108 | | oneFifth | ⅕ | 1/5 |
|
---|
109 | | oneSixth | ⅙ | 1/6 |
|
---|
110 | | oneSeventh | ⅐ | 1/7 |
|
---|
111 | | oneEighth | ⅛ | 1/8 |
|
---|
112 | | oneNinth | ⅑ | 1/9 |
|
---|
113 | | oneTenth | ⅒ | 1/10 |
|
---|
114 | | twoThirds | ⅔ | 2/3 |
|
---|
115 | | twoFifths | ⅖ | 2/5 |
|
---|
116 | | threeQuarters | ¾ | 3/4 |
|
---|
117 | | threeFifths | ⅗ | 3/5 |
|
---|
118 | | threeEighths | ⅜ | 3/8 |
|
---|
119 | | fourFifths | ⅘ | 4/5 |
|
---|
120 | | fiveSixths | ⅚ | 5/6 |
|
---|
121 | | fiveEighths | ⅝ | 5/8 |
|
---|
122 | | sevenEighths | ⅞ | 7/8 |
|
---|
123 |
|
---|
124 |
|
---|
125 | ## Related
|
---|
126 |
|
---|
127 | - [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels
|
---|
128 |
|
---|
129 | ---
|
---|
130 |
|
---|
131 | <div align="center">
|
---|
132 | <b>
|
---|
133 | <a href="https://tidelift.com/subscription/pkg/npm-figures?utm_source=npm-figures&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
---|
134 | </b>
|
---|
135 | <br>
|
---|
136 | <sub>
|
---|
137 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
---|
138 | </sub>
|
---|
139 | </div>
|
---|