pax_global_header00006660000000000000000000000064140676643220014524gustar00rootroot0000000000000052 comment=17eea35d7c0d37d510c299c923350d10a01b960a figures-4.0.0/000077500000000000000000000000001406766432200131715ustar00rootroot00000000000000figures-4.0.0/.editorconfig000066400000000000000000000002571406766432200156520ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 figures-4.0.0/.gitattributes000066400000000000000000000000231406766432200160570ustar00rootroot00000000000000* text=auto eol=lf figures-4.0.0/.github/000077500000000000000000000000001406766432200145315ustar00rootroot00000000000000figures-4.0.0/.github/funding.yml000066400000000000000000000001611406766432200167040ustar00rootroot00000000000000github: sindresorhus open_collective: sindresorhus tidelift: npm/figures custom: https://sindresorhus.com/donate figures-4.0.0/.github/security.md000066400000000000000000000002631406766432200167230ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. figures-4.0.0/.github/workflows/000077500000000000000000000000001406766432200165665ustar00rootroot00000000000000figures-4.0.0/.github/workflows/main.yml000066400000000000000000000010141406766432200202310ustar00rootroot00000000000000name: CI on: - push - pull_request jobs: test: name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: node-version: - 16 - 14 - 12 os: - ubuntu-latest - windows-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test figures-4.0.0/.gitignore000066400000000000000000000000271406766432200151600ustar00rootroot00000000000000node_modules yarn.lock figures-4.0.0/.npmrc000066400000000000000000000000231406766432200143040ustar00rootroot00000000000000package-lock=false figures-4.0.0/index.d.ts000066400000000000000000000216721406766432200151020ustar00rootroot00000000000000declare const figureSet: { readonly tick: string; readonly info: string; readonly warning: string; readonly cross: string; readonly square: string; readonly squareSmall: string; readonly squareSmallFilled: string; readonly squareDarkShade: string; readonly squareMediumShade: string; readonly squareLightShade: string; readonly squareTop: string; readonly squareBottom: string; readonly squareLeft: string; readonly squareRight: string; readonly squareCenter: string; readonly circle: string; readonly circleFilled: string; readonly circleDotted: string; readonly circleDouble: string; readonly circleCircle: string; readonly circleCross: string; readonly circlePipe: string; readonly circleQuestionMark: string; readonly radioOn: string; readonly radioOff: string; readonly checkboxOn: string; readonly checkboxOff: string; readonly checkboxCircleOn: string; readonly checkboxCircleOff: string; readonly questionMarkPrefix: string; readonly bullet: string; readonly dot: string; readonly ellipsis: string; readonly pointer: string; readonly pointerSmall: string; readonly triangleUp: string; readonly triangleUpSmall: string; readonly triangleUpOutline: string; readonly triangleDown: string; readonly triangleDownSmall: string; readonly triangleLeft: string; readonly triangleLeftSmall: string; readonly triangleRight: string; readonly triangleRightSmall: string; readonly lozenge: string; readonly lozengeOutline: string; readonly home: string; readonly hamburger: string; readonly smiley: string; readonly mustache: string; readonly heart: string; readonly star: string; readonly play: string; readonly musicNote: string; readonly musicNoteBeamed: string; readonly nodejs: string; readonly arrowUp: string; readonly arrowDown: string; readonly arrowLeft: string; readonly arrowRight: string; readonly arrowLeftRight: string; readonly arrowUpDown: string; readonly almostEqual: string; readonly notEqual: string; readonly lessOrEqual: string; readonly greaterOrEqual: string; readonly identical: string; readonly infinity: string; readonly subscriptZero: string; readonly subscriptOne: string; readonly subscriptTwo: string; readonly subscriptThree: string; readonly subscriptFour: string; readonly subscriptFive: string; readonly subscriptSix: string; readonly subscriptSeven: string; readonly subscriptEight: string; readonly subscriptNine: string; readonly oneHalf: string; readonly oneThird: string; readonly oneQuarter: string; readonly oneFifth: string; readonly oneSixth: string; readonly oneSeventh: string; readonly oneEighth: string; readonly oneNinth: string; readonly oneTenth: string; readonly twoThirds: string; readonly twoFifths: string; readonly threeQuarters: string; readonly threeFifths: string; readonly threeEighths: string; readonly fourFifths: string; readonly fiveSixths: string; readonly fiveEighths: string; readonly sevenEighth: string; readonly line: string; readonly lineBold: string; readonly lineDouble: string; readonly lineDashed0: string; readonly lineDashed1: string; readonly lineDashed2: string; readonly lineDashed3: string; readonly lineDashed4: string; readonly lineDashed5: string; readonly lineDashed6: string; readonly lineDashed7: string; readonly lineDashed8: string; readonly lineDashed9: string; readonly lineDashed10: string; readonly lineDashed11: string; readonly lineDashed12: string; readonly lineDashed13: string; readonly lineDashed14: string; readonly lineDashed15: string; readonly lineVertical: string; readonly lineVerticalBold: string; readonly lineVerticalDouble: string; readonly lineVerticalDashed0: string; readonly lineVerticalDashed1: string; readonly lineVerticalDashed2: string; readonly lineVerticalDashed3: string; readonly lineVerticalDashed4: string; readonly lineVerticalDashed5: string; readonly lineVerticalDashed6: string; readonly lineVerticalDashed7: string; readonly lineVerticalDashed8: string; readonly lineVerticalDashed9: string; readonly lineVerticalDashed10: string; readonly lineVerticalDashed11: string; readonly lineDownLeft: string; readonly lineDownLeftArc: string; readonly lineDownBoldLeftBold: string; readonly lineDownBoldLeft: string; readonly lineDownLeftBold: string; readonly lineDownDoubleLeftDouble: string; readonly lineDownDoubleLeft: string; readonly lineDownLeftDouble: string; readonly lineDownRight: string; readonly lineDownRightArc: string; readonly lineDownBoldRightBold: string; readonly lineDownBoldRight: string; readonly lineDownRightBold: string; readonly lineDownDoubleRightDouble: string; readonly lineDownDoubleRight: string; readonly lineDownRightDouble: string; readonly lineUpLeft: string; readonly lineUpLeftArc: string; readonly lineUpBoldLeftBold: string; readonly lineUpBoldLeft: string; readonly lineUpLeftBold: string; readonly lineUpDoubleLeftDouble: string; readonly lineUpDoubleLeft: string; readonly lineUpLeftDouble: string; readonly lineUpRight: string; readonly lineUpRightArc: string; readonly lineUpBoldRightBold: string; readonly lineUpBoldRight: string; readonly lineUpRightBold: string; readonly lineUpDoubleRightDouble: string; readonly lineUpDoubleRight: string; readonly lineUpRightDouble: string; readonly lineUpDownLeft: string; readonly lineUpBoldDownBoldLeftBold: string; readonly lineUpBoldDownBoldLeft: string; readonly lineUpDownLeftBold: string; readonly lineUpBoldDownLeftBold: string; readonly lineUpDownBoldLeftBold: string; readonly lineUpDownBoldLeft: string; readonly lineUpBoldDownLeft: string; readonly lineUpDoubleDownDoubleLeftDouble: string; readonly lineUpDoubleDownDoubleLeft: string; readonly lineUpDownLeftDouble: string; readonly lineUpDownRight: string; readonly lineUpBoldDownBoldRightBold: string; readonly lineUpBoldDownBoldRight: string; readonly lineUpDownRightBold: string; readonly lineUpBoldDownRightBold: string; readonly lineUpDownBoldRightBold: string; readonly lineUpDownBoldRight: string; readonly lineUpBoldDownRight: string; readonly lineUpDoubleDownDoubleRightDouble: string; readonly lineUpDoubleDownDoubleRight: string; readonly lineUpDownRightDouble: string; readonly lineDownLeftRight: string; readonly lineDownBoldLeftBoldRightBold: string; readonly lineDownLeftBoldRightBold: string; readonly lineDownBoldLeftRight: string; readonly lineDownBoldLeftBoldRight: string; readonly lineDownBoldLeftRightBold: string; readonly lineDownLeftRightBold: string; readonly lineDownLeftBoldRight: string; readonly lineDownDoubleLeftDoubleRightDouble: string; readonly lineDownDoubleLeftRight: string; readonly lineDownLeftDoubleRightDouble: string; readonly lineUpLeftRight: string; readonly lineUpBoldLeftBoldRightBold: string; readonly lineUpLeftBoldRightBold: string; readonly lineUpBoldLeftRight: string; readonly lineUpBoldLeftBoldRight: string; readonly lineUpBoldLeftRightBold: string; readonly lineUpLeftRightBold: string; readonly lineUpLeftBoldRight: string; readonly lineUpDoubleLeftDoubleRightDouble: string; readonly lineUpDoubleLeftRight: string; readonly lineUpLeftDoubleRightDouble: string; readonly lineUpDownLeftRight: string; readonly lineUpBoldDownBoldLeftBoldRightBold: string; readonly lineUpDownBoldLeftBoldRightBold: string; readonly lineUpBoldDownLeftBoldRightBold: string; readonly lineUpBoldDownBoldLeftRightBold: string; readonly lineUpBoldDownBoldLeftBoldRight: string; readonly lineUpBoldDownLeftRight: string; readonly lineUpDownBoldLeftRight: string; readonly lineUpDownLeftBoldRight: string; readonly lineUpDownLeftRightBold: string; readonly lineUpBoldDownBoldLeftRight: string; readonly lineUpDownLeftBoldRightBold: string; readonly lineUpBoldDownLeftBoldRight: string; readonly lineUpBoldDownLeftRightBold: string; readonly lineUpDownBoldLeftBoldRight: string; readonly lineUpDownBoldLeftRightBold: string; readonly lineUpDoubleDownDoubleLeftDoubleRightDouble: string; readonly lineUpDoubleDownDoubleLeftRight: string; readonly lineUpDownLeftDoubleRightDouble: string; readonly lineCross: string; readonly lineBackslash: string; readonly lineSlash: string; }; type FigureSet = typeof figureSet; /** Symbols to use when the terminal supports Unicode symbols. */ export const mainSymbols: FigureSet; /** Symbols to use when the terminal does not support Unicode symbols. */ export const fallbackSymbols: FigureSet; /** Symbols to use on any terminal. */ export default figureSet; /** Replace Unicode symbols depending on the terminal. @param string - String where the Unicode symbols will be replaced with fallback symbols depending on the terminal. @returns The input with replaced fallback Unicode symbols. @example ``` import figures, {replaceSymbols} from 'figures'; console.log(replaceSymbols('✔︎ check')); // On terminals with Unicode symbols: ✔︎ check // On other terminals: √ check console.log(figures.tick); // On terminals with Unicode symbols: ✔︎ // On other terminals: √ ``` */ export function replaceSymbols(string: string): string; figures-4.0.0/index.js000066400000000000000000000175331406766432200146470ustar00rootroot00000000000000import escapeStringRegexp from 'escape-string-regexp'; import isUnicodeSupported from 'is-unicode-supported'; const {platform} = process; const common = { square: '█', squareDarkShade: '▓', squareMediumShade: '▒', squareLightShade: '░', squareTop: '▀', squareBottom: '▄', squareLeft: '▌', squareRight: '▐', squareCenter: '■', bullet: '●', dot: '․', ellipsis: '…', pointerSmall: '›', triangleUp: '▲', triangleUpSmall: '▴', triangleDown: '▼', triangleDownSmall: '▾', triangleLeftSmall: '◂', triangleRightSmall: '▸', home: '⌂', heart: '♥', musicNote: '♪', musicNoteBeamed: '♫', 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: '⅙', oneEighth: '⅛', 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: '╱' }; export const mainSymbols = { ...common, // The main symbols for those do not look that good on Ubuntu. ...( platform === 'linux' ? { circleQuestionMark: '?⃝', questionMarkPrefix: '?⃝' } : { circleQuestionMark: '?', questionMarkPrefix: '?' } ), tick: '✔', info: 'ℹ', warning: '⚠', cross: '✖', squareSmall: '◻', squareSmallFilled: '◼', circle: '◯', circleFilled: '◉', circleDotted: '◌', circleDouble: '◎', circleCircle: 'ⓞ', circleCross: 'ⓧ', circlePipe: 'Ⓘ', radioOn: '◉', radioOff: '◯', checkboxOn: '☒', checkboxOff: '☐', checkboxCircleOn: 'ⓧ', checkboxCircleOff: 'Ⓘ', pointer: '❯', triangleUpOutline: '△', triangleLeft: '◀', triangleRight: '▶', lozenge: '◆', lozengeOutline: '◇', hamburger: '☰', smiley: '㋡', mustache: '෴', star: '★', play: '▶', nodejs: '⬢', oneSeventh: '⅐', oneNinth: '⅑', oneTenth: '⅒' }; export const fallbackSymbols = { ...common, tick: '√', info: 'i', warning: '‼', cross: '×', squareSmall: '□', squareSmallFilled: '■', circle: '( )', circleFilled: '(*)', circleDotted: '( )', circleDouble: '( )', circleCircle: '(○)', circleCross: '(×)', circlePipe: '(│)', circleQuestionMark: '(?)', radioOn: '(*)', radioOff: '( )', checkboxOn: '[×]', checkboxOff: '[ ]', checkboxCircleOn: '(×)', checkboxCircleOff: '( )', questionMarkPrefix: '?', pointer: '>', triangleUpOutline: '∆', triangleLeft: '◄', triangleRight: '►', lozenge: '♦', lozengeOutline: '◊', hamburger: '≡', smiley: '☺', mustache: '┌─┐', star: '✶', play: '►', nodejs: '♦', oneSeventh: '1/7', oneNinth: '1/9', oneTenth: '1/10' }; const shouldUseMain = isUnicodeSupported(); const figures = shouldUseMain ? mainSymbols : fallbackSymbols; export default figures; const isFallbackSymbol = (key, mainSymbol) => fallbackSymbols[key] !== mainSymbol; const getFigureRegExp = (key, mainSymbol) => [new RegExp(escapeStringRegexp(mainSymbol), 'g'), fallbackSymbols[key]]; let replacements = []; const getReplacements = () => { if (replacements.length > 0) { return replacements; } replacements = Object.entries(mainSymbols) .filter(([key, mainSymbol]) => isFallbackSymbol(key, mainSymbol)) .map(([key, mainSymbol]) => getFigureRegExp(key, mainSymbol)); return replacements; }; // On terminals which do not support Unicode symbols, substitute them to other symbols export const replaceSymbols = string => { if (shouldUseMain) { return string; } for (const [figureRegExp, fallbackSymbol] of getReplacements()) { string = string.replace(figureRegExp, fallbackSymbol); } return string; }; figures-4.0.0/index.test-d.ts000066400000000000000000000004311406766432200160450ustar00rootroot00000000000000import {expectType} from 'tsd'; import figures, {replaceSymbols, mainSymbols, fallbackSymbols} from './index.js'; expectType(replaceSymbols('✔︎ check')); expectType(figures.tick); expectType(mainSymbols.tick); expectType(fallbackSymbols.tick); figures-4.0.0/license000066400000000000000000000021351406766432200145370ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. figures-4.0.0/package.json000066400000000000000000000015441406766432200154630ustar00rootroot00000000000000{ "name": "figures", "version": "4.0.0", "description": "Unicode symbols with fallbacks for older terminals", "license": "MIT", "repository": "sindresorhus/figures", "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, "type": "module", "exports": "./index.js", "engines": { "node": ">=12" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "unicode", "cli", "cmd", "command-line", "characters", "symbol", "symbols", "figure", "figures", "fallback" ], "dependencies": { "escape-string-regexp": "^5.0.0", "is-unicode-supported": "^1.0.0" }, "devDependencies": { "ava": "^3.15.0", "tsd": "^0.17.0", "typescript": "^4.3.5", "xo": "^0.40.3" } } figures-4.0.0/readme.md000066400000000000000000000427611406766432200147620ustar00rootroot00000000000000# figures > Unicode symbols with fallbacks for older terminals [![](screenshot.png)](index.js) [*and more...*](index.js) Terminals such as Windows Console Host (and CMD) only support a [limited character set](http://en.wikipedia.org/wiki/Code_page_437). ## Install ``` $ npm install figures ``` ## Usage ```js 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 terminal: √ console.log(figures.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) Returns the input with replaced fallback Unicode symbols on older terminals. All the below [figures](#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. ## 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](https://github.com/ehmicky/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 - [log-symbols](https://github.com/sindresorhus/log-symbols) - Colored symbols for various log levels ---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
figures-4.0.0/screenshot.png000066400000000000000000000122471406766432200160620ustar00rootroot00000000000000PNG  IHDR$ӦSnIDATxױKsX \6666 lll 60@.TU]UUU]UUUvUUUvUUUvUUU5UUU5UUU5UUUlWUUlWUUlWUUlWUUU]UUU]UUU]UUU6@.TUUlWUUlWUUU]UUU]UUU]UUUvUUUvUUUvUUUvUUU5UUU5UUU5UUUlWUUlWUUlWU;qV8'?v,WB0( A` ARA|ۻI_w>l҄]A YΟN b 68OFyI@ll0< _6McTU8 W9Umt 3ONe=;0M|3E6b'ˋJ5b7ܯ}F@ig ü;q@NR(t\E|em,amԆL @4ǖ6z'p-m6{ljXr-}/_{[D [N$Glz❹ %kїdg 8Vq(iGaozqHfK pA;Ӛ+r-cmKv%+ƌ% >PʟLɴOkDi4]!+"bոYHά Iw2o'68w] 3\-ͫ^`!D}14ndlâlD ߭Z &^`gE5ʪC:[m3x~V[ڇz߽ۖ-D% ?mEpZ\&+b[+:h⛭wV{S+v[]"D63>ہSa}}pAW:">۶Jrb3*-ꪸHz "mDV$Z_|>`+Cz Qf~,OKuۮXmxnsҙ0jQ'X2[G: S w1[ky;]fn(7v)/[FnN\ԶHT%ӅYYxg@-c_3'.W{%yJu 3 #'/m'' WR ':áP( AA`A@ T49lf L.W:ݛ݅S&vy}t`_0.8sm+yZRs*7DR!@ 0 3}W .z;pFܐmB?P -WŢQf b;i)̳m^Qr}UU|SM W3~CO7q}'+JNuspѪu{z'[%!=qaf\o'{CzhId>Kz^R$Zsֱؾ0*m"ypkEJ|n_ںW+tAo7SvǫYWcRp)tn&8Zqw -MvNO?@X62?Ksm *m!V6砍y]mK;VOi$DNb;h|F8foL7 wCNcz|{1Pjco]VzuzLRZ0h}[R7 DrgbT<*ǡ"i^_+$LNTOGlSq}ǫWEn|1W ?!`)^/yAť?qC2Fy=4 F$2Wīz]ұ$W#e<ض*,=Tjoئ HQiouy;/Py\l=Dunt|8Bbnç/xEonc~\q4׸.*~-.-miGG``*4=UއU^H^c%xlmi/.%KgrM_6n}%2۬^? `a;vϒEaIkۣidK67^ퟳA84 Y'9l"bۢئ>_S(߱͌ܣSPok|T'p-,'M©\lzT鞎iDqEU7]?L"sSo2O`"߳MmN{)Җ]WƃKb~:(dT$wLiul~fB*2sOd ϧ;LhW黚 Z?I! fm+I8;]x>ۖ6<*VJRrY$w̨߹>J=v%mo[{a6ݪ8ϕġg:WVC i#՗~0O}^( vMf5fE/Qu\G_fm~l_T<_~\lJ\l͇qI,Re nj=3ژAa\x}2I@k(L~<50%[zc9`'bvxe?Tڮ3p?tئX"Sͼ]ם*|pβF\ƚOKHϴG*O 7CjG`lĵ.:9&.uQo[i?d>ʼئzC $s]\l\E8?Y9i=b7?Q'+z^~X\BaPc05 @ Hy=ftY ܊۽K[20y4fv%WxU̇W0~ZW4vEο"8yܓ+6כ65X ,M2:)aKU" +|MDt!SE;\uGV~<%= 6iW<˚K@vޞ#k}hlgK[5n)ϛci,+Zވ~`~p1}{c3fYf_^_t.m jmY-W6K{y%Gs?{е"*2c6vsNq8,D%N v{a~"9m1^|l` UG-mMQ7,"po*m6;JJ߭p灠7Clx}.-Ƕڽ+vO_5]\ɷ6d$\1J3kJc{dޢ8@K{t2t:'1{{FwnZQ1̦RX,6O ';^oȱ oAv֘^D,} U(i ?CJz 4QKMf_c isUnicodeSupported() ? mainSymbols : fallbackSymbols; console.log(` ${Object.values(figures).join(' ')}\n`); test('figures', t => { t.is(figures.tick, result('✔', '√')); }); test('replaceSymbols()', t => { t.is(replaceSymbols('foo'), 'foo'); t.is(replaceSymbols('?bar?'), '?bar?'); t.is(replaceSymbols('✔ ✔ ✔'), result('✔ ✔ ✔', '√ √ √')); t.is(replaceSymbols('✔ ✖\n★ ◼'), result('✔ ✖\n★ ◼', '√ ×\n✶ ■')); t.is(replaceSymbols('✔ ✖ ★ ◼'), result('✔ ✖ ★ ◼', '√ × ✶ ■')); }); test('mainSymbols and windowsSymbols', t => { t.is(mainSymbols.tick, '✔'); t.is(fallbackSymbols.tick, '√'); }); test('figures are non-empty strings', t => { for (const figure of Object.values(figures)) { t.true(typeof figure === 'string' && figure.trim() !== ''); } });