{"id":13846818,"url":"https://github.com/liambloom/command-line-draw","last_synced_at":"2025-07-12T07:33:09.932Z","repository":{"id":154994338,"uuid":"250687357","full_name":"liambloom/command-line-draw","owner":"liambloom","description":"A library that allows you to draw and move things on the command line","archived":false,"fork":false,"pushed_at":"2022-03-29T16:25:14.000Z","size":207,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-21T21:42:27.151Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/command-line-draw","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liambloom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-28T01:19:02.000Z","updated_at":"2024-02-20T09:36:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"943013e9-fdd9-4e4a-bcca-5bab53fb2823","html_url":"https://github.com/liambloom/command-line-draw","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/liambloom/command-line-draw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liambloom%2Fcommand-line-draw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liambloom%2Fcommand-line-draw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liambloom%2Fcommand-line-draw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liambloom%2Fcommand-line-draw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liambloom","download_url":"https://codeload.github.com/liambloom/command-line-draw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liambloom%2Fcommand-line-draw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264958194,"owners_count":23689010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T18:00:48.349Z","updated_at":"2025-07-12T07:33:09.547Z","avatar_url":"https://github.com/liambloom.png","language":"JavaScript","readme":"# CMD Draw\n\nA library that allows you to draw and animate on the command line. I created it to make [this](https://www.npmjs.com/package/command-line-pong) version of pong for the command line.\n\n![](https://badgen.net/npm/v/command-line-draw)\n![](https://badgen.net/badge/node/\u003e=12.0.0/green)\n![](https://badgen.net/npm/dt/command-line-draw)\n![](https://badgen.net/badge/licence/MIT)\n\n# Installation\n\n```\n$ npm i command-line-draw\n```\n\n# Documentation\n\nThere are 4 classes exported by this module, and this section contains documentation for all 4. \n\n*__A quick note:__ npm's styling makes this documentation somewhat difficult to read, it may be easier to read it on [github](https://github.com/liambloom/command-line-draw#readme).*\n\n## Table of contents\n\n  - [Class: `Terminal`](#class-terminal)\n    - [`new Terminal([config])`](#new-terminalconfig)\n    - [Static: `Terminal.BORDERS`](#static-terminalborders)\n    - [Static: `Terminal.BOTTOM`](#static-terminalbottom)\n    - [Static: `Terminal.FULL`](#static-terminalfull)\n    - [Static: `Terminal.LEFT`](#static-terminalleft)\n    - [Static: `Terminal.RIGHT`](#static-terminalright)\n    - [Static: `Terminal.TOP`](#static-terminaltop)\n    - [Static: `Terminal.bitmapPresets`](#static-terminalbitmappresets)\n      - [Static: `Terminal.bitmapPresets.letters`](#static-terminalbitmappresetsletters)\n      - [Static: `Terminal.bitmapPresets.punctuation`](#static-terminalbitmappresetspunctuation)\n    - [Static: `Terminal.sevenSegmentPresets`](#static-terminalsevensegmentpresets)\n      - [Static: `Terminal.sevenSegmentPresets.numbers`](#static-terminalsevensegmentpresetsnumbers)\n    - [Event: `'\u003ckeyName\u003e'`](#event-keyname)\n    - [Event: `'resize'`](#event-resize)\n    - [`terminal.addSprite(sprite)`](#terminaladdSpritesprite)\n    - [`terminal.bitmap(x, y[, color], ...matrixes)`](#terminalbitmapx-y-color-matrixes)\n    - [`terminal.borderChars`](#terminalborderchars)\n    - [`terminal.borderStyle`](#terminalborderstyle)\n    - [`terminal.clear()`](#terminalclear)\n    - [`terminal.color`](#terminalcolor)\n    - [`terminal.dev`](#terminaldev)\n    - [`terminal.drawBox(x, y, width, height[, color])`](#terminaldrawBoxx-y-width-height-color)\n    - [`terminal.drawLine(x1, y1, x2, y2[, color][, thickness][, dashed][, dashThickness][, spaceColor])`](#terminaldrawLinex1-y1-x2-y2-color-thickness-dashed-dashThickness-spaceColor)\n    - [`terminal.hasBorder`](#terminalhasborder)\n    - [`terminal.height`](#terminalheight)\n    - [`terminal.in`](#terminalin)\n    - [`terminal.largestBorder`](#terminallargestborder)\n    - [`terminal.log([data][, ...args])`](#terminallogdata-args)\n    - [`terminal.margin`](#terminalmargin)\n    - [`terminal.out`](#terminalout)\n    - [`terminal.sevenSegment(x, y, a, b, c, d, e, f, g[, color])`](#terminalsevensegmentx-y-a-b-c-d-e-f-g-color)\n    - [`terminal.sevenSegmentToBitmap(a, b, c, d, e, f, g)`](#terminalsevensegmenttobitmapa-b-c-d-e-f-g)\n    - [`terminal.time`](#terminaltime)\n    - [`terminal.tooBig`](#terminaltoobig)\n    - [`terminal.width`](#terminalwidth)\n    - [`terminal.write(text, x, y[, color])`](#terminalwritetext-x-y-color)\n    - [`terminal.writeLarge(text, x, y[, color])`](#terminalwritelargetext-x-y-color)\n  - [Class: `Sprite`](#class-sprite)\n    - [`new Sprite(callback[, config])`](#new-spritecallback-config)\n    - [`sprite.callback`](#spritecallback)\n    - [`sprite.clear()`](#spriteclear)\n    - [`sprite.draw(x, y[, ...args])`](#spritedrawx-y-args)\n    - [`sprite.move(x1, y1, x2, y2[, t])`](#spritemovex1-y1-x2-y2-t)\n    - [`sprite.moveRelative(dx, dy[, t])`](#spritemoverelativedx-dy-t)\n    - [`sprite.moveTo(x, y[, t])`](#spritemovetox-y-t)\n    - [`sprite.showing`](#sprite.showing)\n    - [`sprite.speed`](#spritespeed)\n    - [`sprite.stop()`](#spritestop)\n    - [`sprite.x`](#spritex)\n    - [`sprite.xRounder`](#spritexrounder)\n    - [`sprite.y`](#spritey)\n    - [`sprite.yRounder`](#spriteyrounder)\n  - [Class: `Box`](#class-box)\n    - [`new Box(width, height, config)`](#new-boxwidth-height-config)\n    - [`box.height`](#boxheight)\n    - [`box.touching(box)`](#boxtouchingbox)\n    - [`box.width`](#boxwidth)\n  - [Class: `Menu`](#class-menu)\n    - [`new Menu(callback, options[, style])`](#new-menucallback-options-style)\n    - [`menu.borderChars`](#menuborderchars)\n    - [`menu.height`](#menuheight)\n    - [`menu.options`](#menuoptions)\n    - [`menu.style`](#menustyle)\n    - [`menu.width`](#menuwidth)\n  - [Class: `Color` ***Not Exported***](#class-color-not-exported)\n    - [`new Color(out)`](#new-colorout)\n    - [Static: `Color.getBackgroundColor(color)`](#static-colorgetbackgroundcolorcolor)\n    - [Static: `Color.getForegroundColor(color)`](#static-colorgetforegroundcolorcolor)\n    - [Static: `Color.RESET`](#static-colorreset)\n    - [Event: `'change'`](#event-change)\n    - [`color.background`](#colorbackground)\n    - [`color.foreground`](#colorforeground)\n    - [`color.refresh()`](#colorrefresh)\n    - [`color.reset()`](#colorreset)\n  - [Class `Margin` ***Not Exported***](#class-margin-not-exported)\n    - [`new Margin(out, width, height)`](#new-marginout-width-height)\n    - [`margin.lr`](#marginlr)\n    - [`margin.tb`](#margintb)\n  - [Types ![ts](./img/ts-def-18.png)](#types)\n  - [More Info](#more-info)\n    - [Borders](#borders)\n    - [Colors](#colors)\n\n---\n\n## Class: `Terminal`\n\n  - Extends: [`\u003cEventEmitter\u003e`](https://nodejs.org/api/events.html#events_class_eventemitter)\n\nThe terminal object represents the drawing space.\n\n```js\nconst { Terminal } = require('command-line-draw');\n```\n\n### `new Terminal([config])`\n\n#### Arguments\n\n- `config` [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n  - `in` [`\u003ctty.ReadStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_readstream) Where the `Terminal` reads user input from. **Default:** `process.stdin`.\n  - `out` [`\u003ctty.WriteStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_writestream) Where the `Terminal` writes to. **Default:** `process.stdout`.\n  - `width` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The width of the `Terminal`. **Default:** `terminal.out.columns - 2`.\n  - `height` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The height of the `Terminal`. **Default:** `terminal.out.rows - 2`.\n  - `border` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The border style of the terminal. See [here](#borders) for a list of valid border styles. **Default:** `'light'`.\n  - `color` [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n    - `foreground` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The foreground color of the `Terminal`. See [here](#colors) for a list of valid colors. **Default:** `'black'`.\n    - `background` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The background color of the `Terminal`. See [here](#colors) for a list of valid colors. **Default:** `'white'`.\n  - `dev` [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Determines behavior of [`terminal.log()`](#terminal.logdata-args). **Default:** `false`.\n\nCreates a new `Terminal` object.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\n```\n\n### Static: `Terminal.BORDERS`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing several [unicode box drawing characters](https://en.wikipedia.org/wiki/Box-drawing_character#Unicode), sorted into different [border types](#borders)\n\n### Static: `Terminal.BOTTOM`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA constant equal to the unicode character [U+2584 (Lower half block)](https://www.fileformat.info/info/unicode/char/2584/index.htm).\n\n### Static: `Terminal.FULL`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA constant equal to the unicode character [U+2588 (Full block)](https://www.fileformat.info/info/unicode/char/2588/index.htm).\n\n### Static: `Terminal.LEFT`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA constant equal to the unicode character [U+258C (Left half block)](https://www.fileformat.info/info/unicode/char/258c/index.htm)\n\n### Static: `Terminal.RIGHT`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA constant equal to the unicode character [U+2590 (Right half block)](https://www.fileformat.info/info/unicode/char/2590/index.htm)\n\n### Static: `Terminal.TOP`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA constant equal to the unicode character [U+2580 (Upper half block)](https://www.fileformat.info/info/unicode/char/2580/index.htm).\n\n### Static: `Terminal.bitmapPresets`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing [`boolean[][]`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)s that can be passed into [`terminal.bitmap()`](#terminalbitmapx-y-color-matrixes) to print letters and punctuation.\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nterminal.bitmap(0, 0, ...Terminal.bitmapPresets.letters.A);\n```\n\n### Static: `Terminal.bitmapPresets.letters`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing letters that can be passed into [`terminal.bitmap()`](#terminalbitmapx-y-color-matrixes). They are indexed `\"A\"`-`\"Z\"`.\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nterminal.bitmap(0, 0, ...Terminal.bitmapPresets.letters.A); // Prints a large letter \"A\" to the terminal\n```\n\n### Static: `Terminal.bitmapPresets.punctuation`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing punctuation that can be passed into [`terminal.bitmap()`](#terminalbitmapx-y-color-matrixes). Included punctuation is `\".\"`, `\"?\"`, and `\"!\"`.\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nterminal.bitmap(0, 0, ...Terminal.bitmapPresets.punctuation[\"!\"]); // Prints a large exclamation point to the terminal\n```\n\n### Static: `Terminal.sevenSegmentPresets`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing [`boolean[]`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)s that, using the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax), can be passed into [`terminal.sevenSegment()`](#terminalsevensegmentx-y-a-b-c-d-e-f-g-color) or [`terminal.sevenSegmentToBitmap()`](#terminalsevensegmenttobitmapa-b-c-d-e-f-g).\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nterminal.sevenSegment(0, 0, ...Terminal.sevenSegmentPresets.numbers[0]); // Prints a large number 0 to the terminal\n```\n\n### Static: `Terminal.sevenSegmentPresets.numbers`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\nAn object containing [`boolean[]`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)s that, using the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax), can be passed into [`terminal.sevenSegment()`](#terminalsevensegmentx-y-a-b-c-d-e-f-g-color) or [`terminal.sevenSegmentToBitmap()`](#terminalsevensegmenttobitmapa-b-c-d-e-f-g). They are indexed `\"0\"`-`\"9\"`.\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nterminal.sevenSegment(0, 0, ...Terminal.sevenSegmentPresets.numbers[0]);\n```\n\n### Event: `'\u003ckeyName\u003e'`\n\nOn all key presses, with the exception of `ctrl+c`, an event is emitted. The implementation is as follows:\n\n```js\nterminal.in.on(\"keypress\", (chunk, key) =\u003e {\n  if (key.ctrl \u0026\u0026 !key.meta \u0026\u0026 !key.shift \u0026\u0026 key.name === \"c\") process.exit();\n  else if (!this.tooBig) {\n    let eventName = \"\";\n    if (key.ctrl) eventName += \"ctrl+\";\n    if (key.meta) eventName += \"alt+\";\n    if (key.shift) eventName += \"shift+\";\n    eventName += key.name;\n    this.emit(eventName, key);\n  }\n});\n```\n\nFor example, if the user were to press the up arrow, the event `'up'` would be emitted. If they held shift while pressing up, the event `'shift+up'` would be emitted.\n\n### Event: `'resize'`\n\nThe `'resize'` event is emitted whenever `terminal.out` is resized.\n\n### `terminal.addSprite(sprite)`\n\n  - `sprite` [`\u003cSprite\u003e`](#class-sprite) Sprite to be added.\n\nThe `Sprite` cannot be used until it is added to a terminal. When the terminal is resized, sprites that were showing will automatically be redrawn. Has no affect if sprite is already on the terminal,\n\n```js\nconst { Terminal, Sprite } = require('command-line-draw');\n\nconst terminal = new Terminal();\nconst mySprite = new Sprite((x, y) =\u003e { // See the Sprite class for instructions on how to use this constructor\n  terminal.drawBox(x, y, 10, 10);\n});\n\nterminal.addSprite(mySprite);\nmySprite.draw(0, 0);\n```\n\n### `terminal.bitmap(x, y[, color], ...matrixes)`\n\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate at which to print the bitmap.\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate at which to print the bitmap.\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the bitmap **Default:** `terminal.color.foreground`.\n  - `matrixes` [`\u003cboolean[][]\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Matrix(es) that represent the bitmap you want to print\n\nPrints a series of bitmaps at a particular position. The bitmaps are a matrix of booleans. `true` prints `██` in the foreground color, false prints two spaces in the background color.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\n\nterminal.bitmap(0, 0, [\n  [true, true, true],\n  [true, false, true],\n  [true, false, true],\n  [true, false, true],\n  [true, true, true]\n]); // Prints a large '0' in the command line\n```\n\n### `terminal.borderChars`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe characters the border is made up of. Equal to `Terminal.BORDERS[terminal.borderStyle]`\n\n### `terminal.borderStyle`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nA string representing the type of border the `terminal` has. See [here](#borders) for a list of valid border styles.\n\n### `terminal.clear()`\n\nClears the entire terminal (including logged messages). The border remains visible. Any moving [`sprites`](#class-sprite) also stop and are cleared.\n\n### `terminal.drawBox(x, y, width, height[, color])`\n\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate of the top-left corner of the box.\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate of the top-left corner of the box.\n  - `width` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The width of the box.\n  - `height` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The height of the box.\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the box **Default:** `terminal.color.foreground`.\n\nDraws a box on the terminal. \n\n### `terminal.color`\n\n  - [`\u003cColor\u003e`](#class-color)\n\nA `Color` object containing information about the `terminal`'s color\n\n### `terminal.dev`\n\n  - [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\n\nWhen `false`, [`terminal.log()`](#terminallogdata-args) has no affect. \n\n### `terminal.drawLine(x1, y1, x2, y2[, color][, thickness][, dashed][, dashThickness][, spaceColor])`\n\n  - `x1` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate of the starting point on the line.\n  - `y1` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate of the starting point on the line.\n  - `x2` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate of the ending point on the line.\n  - `y2` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate of the ending point on the line.\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the line. **Default:** `terminal.color.foreground`.\n  - `thickness` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The thickness of the line. **Default:** `1`.\n  - `dashed` [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) When `true`, the line will be dashed (alternating between the `foreground` and `background` color). **Default:** `false`.\n  - `dashThickness` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) How thick the dash will be. (e.g, if this is `1`, the dash will look like this: `█ █ █ █`.) **Default:** `0.5`.\n  - `spaceColor` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the spaces between the dashes in a dashed line. **Default:** `terminal.color.background`.\n\nDraws a line from point `(x1, y1)` to point `(x2, y2)`. Currently, only vertical and horizontal lines are supported, but not diagonals. The coordinates can be decimals, they will be rounded to the nearest `0.5`. Unfortunately, you can only have decimal coordinates on one axis. \n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\nterminal.drawLine(0, 1.5, 10, 1.5); // Draws a line from (0, 1.5) to (10, 1.5)\n```\n\n### `terminal.hasBorder`\n\n  - [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\n\n`true` if `terminal.borderStyle === 'none'`. Otherwise it is `false`.\n\n### `terminal.height`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe height of the `terminal`.\n\n### `terminal.in`\n\n  - [`\u003ctty.ReadStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_readstream)\n\nThe input for the `terminal`.\n\n### `terminal.largestBorder`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe widest of `terminal.borderChars.vertical`, `terminal.borderChars.topLeft`, `terminal.borderChars.bottomLeft`. If `terminal.borderStyle === 'solid'`, it returns `2`, if `terminal.borderStyle === 'none'`, it returns `0`, otherwise it returns `1`.\n\n### `terminal.log([data][, ...args])`\n\n  - `data` [`\u003cany\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) The data to be printed\n  - `...args` [`\u003cany\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Values to be added to the data\n\nIf `terminal.dev === true`, this method prints to `terminal.out` with a new line. If it is false, nothing is printed. Logged messages are not reprinted when the terminal is cleared. See [`console.log()`](https://nodejs.org/api/console.html#console_console_log_data_args) for more details.\n\n### `terminal.margin`\n\n  - [`\u003cMargin\u003e`](#class-margin-not-exported)\n\nA `Margin` object containing information about the `terminal`'s margin\n\n### `terminal.out`.\n\n  - [`\u003ctty.WriteStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_writestream)\n\nThe output for the `terminal`\n\n### `terminal.sevenSegment(x, y, a, b, c, d, e, f, g[, color])`\n\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate at at which to write the seven segment display\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate at at which to write the seven segment display\n  - `a`-`g` [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Boolean values representing each [segment](https://www.rogdham.net/media/correspondance_7seg.png) of the a seven segment display.\n\nPrints a a seven segment display to the terminal. It is 5 characters tall and 6 wide (each segment is 2 characters wide).\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\nterminal.sevenSegment(0, 0, true, true, true, true, true, true, false); // Prints '0', although there multiple easier ways to do this\n```\n\n### `terminal.sevenSegmentToBitmap(a, b, c, d, e, f, g)`\n\n  - `a`-`g` [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) Boolean values representing each [segment](https://www.rogdham.net/media/correspondance_7seg.png) of the a seven segment display.\n  - Returns: [`\u003cboolean[][]\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\n\nTurns seven boolean values (representing the seven [segments](https://www.rogdham.net/media/correspondance_7seg.png) of a seven segment display) and returns a boolean matrix (2D [`\u003cArray\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)) representing each pixel on a 5x3 grid to display the given values.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\n\nconst myBooleanMatrix = terminal.sevenSegmentDisplay(true, true, true, true, true, true, false);\nterminal.bitmap(0, 0, myBooleanMatrix); // Prints '0', although there multiple easier ways to do this\n```\n\n### `terminal.time`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nReturns a time (high resolution time in milliseconds, same as [`performance.now()`](https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_now)). The time does not increase when `terminal.tooBig === true`. It is recommended that you use this to time any animations on the `terminal`.\n\n### `terminal.tooBig`\n\n  - [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\n\nReturns `true` when the `terminal`'s width and height exceed the actual size of the user's command line. Nothing will be drawn until the user's command line becomes larger.\n\n### `terminal.width`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe width of the `terminal`.\n\n### `terminal.write(text, x, y[, color][, backgroundColor])`\n\n  - `text` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The text to be written to the terminal.\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate at which to print the text.\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate at which to print the text.\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the text **Default:** `terminal.color.foreground`.\n  - `backgroundColor` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The background color of the text **Default:** `terminal.color.background`.\n\nWrites text to the terminal at a particular position. If the text is too long and goes outside the terminal, it will not wrap, it will instead throw an error.\n\n### `terminal.writeLarge(text, x, y[, color])`\n\n  - `text` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The text to be written to the terminal.\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate at which to print the text.\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate at which to print the text.\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The color of the text **Default:** `terminal.color.foreground`.\n\nPrints large text to the terminal at a particular position. Each character is a seven segment display with a 2 character space between characters and 6 character space between words. Allowed characters are letters, numbers, and basic punctuation (`.!?`).\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal({\n  dev: true // Do not use this in production, as logging is a simple debugging tool and may not produce desireable results\n});\n\nterminal.log('Hello World');\n```\n\n## Class: `Sprite`\n\n  - Extends: [`\u003cEventEmitter\u003e`](https://nodejs.org/api/events.html#events_class_eventemitter)\n\n### `new Sprite(callback[, config])`\n\n  - `callback` [`\u003cFunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) This callback is called to draw the shape\n    - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate that the `sprite` should be drawn at.\n    - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate that the `sprite` should be drawn at.\n    - `...args` [`\u003cany\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Any other arguments passed into the callback.\n  - `config` [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n    - `preciseAxis` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) `'x'`, `'y'`, or `'neither'`. The axis to use decimal coordinates on. **Default:** `'neither'`.\n    - `speed` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [`\u003cundefined\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The speed the `sprite` should move if a time is not provided in [`sprite.move()`](#spritemovex1-y1-x2-y2-t).\n\n### `sprite.callback`\n\n  - [`\u003cFunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)\n\nThe callback that was passed into the [constructor](#new-spritecallback-config)\n\nCreates a new `sprite` object.\n\n```js\nconst { Terminal, Sprite } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nconst mySprite = new Sprite((x, y) =\u003e {\n  terminal.drawBox(x, y, 10, 10);\n});\n\nterminal.addSprite(mySprite);\nsprite.draw(0, 0); // Draws a 10x10 box at (0, 0)\n```\n\n### `sprite.clear()`\n\nClears the sprite from the terminal.\n\n### `sprite.draw(x, y[, ...args])`\n\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x coordinate to draw the `sprite` at. This is passed into [`sprite.callback`](#spritecallback).\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y coordinate to draw the `sprite` at. This is passed into [`sprite.callback`](#spritecallback).\n  - `...args` [`\u003cany\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types) Other arguments to pass into [`sprite.callback`](#spritecallback).\n\nCalls [`sprite.callback`](#spritecallback) in order to draw the `sprite`.\n\n### `sprite.move(x1, y1, x2, y2[, t])`\n\n  - `x1` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x position for the box to start at.\n  - `y1` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y position for the box to start at.\n  - `x2` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x position for the box to end at.\n  - `y2` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y position for the box to end at.\n  - `t` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The time (in seconds) that the movement should take. **Default:** `distance / terminal.speed * 1000`. *Required if `this.speed === undefined`*.\n\nMoves the `sprite` from (x1, y1) to (x2, y2).\n\n```js\nconst { Terminal, Sprite } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nconst mySprite = new Sprite((x, y) =\u003e {\n  terminal.drawBox(x, y, 10, 10);\n});\n\nterminal.addSprite(mySprite);\nsprite.move(0, 0, 10, 10, 2); // Moves the sprite from (0, 0) to (10, 10) in 2 seconds\n```\n\n### `sprite.moveRelative(dx, dy[, t])`\n\n  - `dx` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The distance to move on the x axis (can be negative).\n  - `dy` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The distance to move on the y axis (can be negative).\n  - `t` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The time (in seconds) that the movement should take. **Default:** `distance / terminal.speed * 1000`. *Required if `this.speed === undefined`*.\n\nMove the `sprite` to a new position relative to it's current position. Or, in simple english, moves it a certain distance from its current position.\n\n### `sprite.moveTo(x, y[, t])`\n\n  - `x` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The x position to move to.\n  - `y` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The y position to move to.\n  - `t` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The time (in seconds) that the movement should take. **Default:** `distance / terminal.speed * 1000`. *Required if `this.speed === undefined`*.\n\nMoves the `sprite` from its current position to the new (x, y) position.\n\n### `sprite.preciseAxis`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe precise axis passed into the config in the [constructor](#new-spritecallback-config).\n\n### `sprite.showing`\n\n  - [`\u003cboolean\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type)\n\nA boolean indicating if the `sprite` is currently viable.\n\n### `sprite.speed`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe current speed of the `sprite`. Is only used by [`sprite.move()`](#spritemovex1-y1-x2-y2-t) if `time` is not provided.\n\n### `sprite.stop()`\n\nStops the `sprite` if it is moving. No effect if the sprite isn't currently moving.\n\n### `sprite.x`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe current x position of the `sprite`\n\n### `sprite.xRounder`\n\n  - [`\u003cFunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)\n\nThe function that rounds the x position. If `sprite.preciseAxis === 'x'`, this is a function that rounds to the nearest `0.5`, otherwise it is equal to [Math.round()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)\n\n### `sprite.y`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe current y position of the `sprite`\n\n### `sprite.yRounder`\n\n  - [`\u003cFunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function)\n\nThe function that rounds the y position. If `sprite.preciseAxis === 'y'`, this is a function that rounds to the nearest `0.5`, otherwise it is equal to [Math.round()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round)\n\n## Class: `Box`\n\n  - Extends: [`\u003cSprite\u003e`](#class-sprite)\n\n### `new Box(width, height, config)`\n\n  - `width` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The width of the box.\n  - `height` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The height of the box.\n  - `config` [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)\n    - `preciseAxis` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) `'x'`, `'y'`, or `'neither'`. The axis to use decimal coordinates on. **Default:** `'y'`.\n    - `speed` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | [`\u003cundefined\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type) The speed the `sprite` should move if a time is not provided in [`sprite.move()`](#spritemovex1-y1-x2-y2-t).\n\nCreates a new `box` object. A `box` is a `sprite` where the callback draws a box of a particular `width` and `height` on the canvas.\n\n```js\nconst { Terminal, Box } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nconst myBox = new Box(10, 10);\n\nterminal.addSprite(myBox);\nmyBox.draw(0, 0); // Draws a 10x10 box at (0, 0)\n```\n\n### `box.height`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe height passed into the constructor. It is readonly, meaning it cannot be set.\n\n### `box.touching(box)`\n\n  - `box` [`\u003cBox\u003e`](#class-box) The box to check the position against.\n\nChecks if two boxes are touching.\n\n```js\nconst { Terminal, Box } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nconst box1 = new Box(5, 5);\nconst box2 = new Box(5, 5);\n\nterminal.addSprite(box1);\nterminal.addSprite(box2);\n\nbox1.draw(0, 0);\nbox2.draw(5, 0);\n\nbox1.touching(box2); // true, the boxes are touching\n```\n\n### `box.width`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe width passed into the constructor. It is readonly, meaning it cannot be set.\n\n## Class: `Menu`\n\n  - Extends: [`\u003cSprite\u003e`](#class-sprite)\n\n### `new Menu(callback, options[, style])`\n\n  - `callback` [`\u003cFunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function) The function called when a menu option is selected\n    - `i` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The index of the menu option selected\n  - `options` [`\u003cstring[]\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A list of menu options\n  - `style` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The style of the border. It can be any style on [this list](#borders) except for `'none'` or `'solid'`. **Default:** `terminal.borderStyle`, or `'light'` if that is invalid.\n\nCreates a new `menu` object. A menu can be drawn and allows the user to select an option from your list of `options`. When the user selects an option, the menu is cleared and the callback is run with the argument `i` being the index of the selected option.\n\n```js\nconst { Terminal, Menu } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\nconst myMenu = new Menu(i =\u003e {\n  // Do something here\n}, [\n  \"First option\",\n  \"Option 2\",\n  \"The 3rd option\",\n  \"Option D\"\n]);\n\nterminal.addSprite(myMenu);\nmyMenu.draw(0, 0);\n\n/**\n * Prints:\n * ┌────────────────┬────────────┬──────────────────┬────────────┐\n * │ 1:First option │ 2:Option 2 │ 3:The 3rd option │ 4:Option D │\n * └────────────────┴────────────┴──────────────────┴────────────┘\n * \n * When an option is selected, this is removed and callback is called.\n * For example, if the user presses 1, the first option, at index 0, was selected.\n * This means that callback(0) is called.\n */ \n```\n\n### `menu.borderChars`\n\n  - [`\u003cObject\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe characters the border is made up of. Equal to `Terminal.BORDERS[menu.style]`. If accessed before this is added to a terminal, it will throw and error if a `style` was not passed into the [constructor](#new-menucallback-options-style).\n\n### `menu.height`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe height of the menu. Always set to `3`.\n\n### `menu.options`\n\n  - [`\u003cstring[]\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe list of options passed into the [constructor](#new-menucallback-options-style).\n\n### `menu.style`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe style passed into the [constructor](#new-menucallback-options-style). If no style was passed into the constructor, it will throw an error before it has been added to a terminal. After it has been added, it will default to `terminal.borderStyle`, and, if that is invalid, will default to `'light'`.\n\n### `menu.width`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe width of the menu.\n\n## Class: `Color` *Not Exported*\n\n  - Extends: [`\u003cEventEmitter\u003e`](https://nodejs.org/api/events.html#events_class_eventemitter)\n\nThe class `Color` is not exported, however, [`terminal.color`](#terminalcolor) is an instance of it, so its properties and methods are still available to you.\n\n### `new Color(out)`\n\n  - `out` [`\u003ctty.WriteStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_writestream) The write stream to add colors to.\n\nCreates a new `Color` object.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\n\nconst Color = terminal.color.constructor\nconst color = new Color(process.stdout); // There is literally no reason ever to do this\n```\n\n### Static: `Color.getBackgroundColor(color)`\n\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The name of a color. See [here](#colors) for a list of valid colors.\n  - Returns: [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A node.js color escape code. You can find a list of those [here](https://stackoverflow.com/a/41407246).\n\nReturns the color code associated width the `color` you enter.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\nterminal.color.constructor.getBackgroundColor('black'); // =\u003e '\\x1b40m'\n```\n\n### Static: `Color.getForegroundColor(color)`\n\n  - `color` [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The name of a color. See [here](#colors) for a list of valid colors.\n  - Returns: [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) A node.js color escape code. You can find a list of those [here](https://stackoverflow.com/a/41407246).\n\nReturns the color code associated width the `color` you enter.\n\n```js\nconst { Terminal } = require('command-line-draw');\n\nconst terminal = new Terminal();\nterminal.color.constructor.getForegroundColor('black'); // =\u003e '\\x1b30m'\n```\n\n### Static: `Color.RESET`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe node.js escape code that clears all formatting from the console (`'\\x1b[0m'`).\n\n### Event: `'change'`\n\nThe `'change'` event is emitted whenever `color.reset()` is run or `color.foreground` or `color.background` are set\n\n### `color.background`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [`\u003cundefined\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type)\n\nThe name of the current background color of the terminal. Is settable. See a list of valid color names [here](#colors).\n\n### `color.foreground`\n\n  - [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [`\u003cundefined\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type)\n\nThe name of the current foreground color of the terminal. Is settable. See a list of valid color names [here](#colors).\n\n### `color.refresh()`\n\nClears formatting, then reapplies `this.foreground` and `this.background` colors.\n\n### `color.reset()`\n\nResets `this.foreground` and `this.background` to `undefined`\n\n## Class: `Margin` *Not Exported*\n\nThe class `Color` is not exported, however, [`terminal.margin`](#terminalmargin) is an instance of it, so its properties and methods are still available to you.\n\n### `new Margin(out, width, height)`\n\n  - `out` [`\u003ctty.WriteStream\u003e`](https://nodejs.org/api/tty.html#tty_class_tty_writestream) The write stream that the `terminal` is on.\n  - `width` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The width of the `terminal`.\n  - `height` [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) The height of the `terminal`.\n\nCreates a new `Margin` object. There is no reason for you to *ever* use this, I just included it for completion\n\n```js\nconst { Terminal } = require(\"command-line-draw\");\n\nconst terminal = new Terminal();\n\nconst Margin = terminal.margin.constructor;\nconst myMargin = new Margin(process.stdout, terminal.width, terminal.height); // There is no reason for you to ever do this.\n```\n\n### `margin.lr`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe left-right margin of the `terminal`. If this is less than `terminal.largestBorder`, then the terminal will disappear and `terminal.tooBig` will be set to `true`\n\n### `margin.tb`\n\n  - [`\u003cnumber\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type)\n\nThe top-bottom margin of the `terminal`. If this is less than `1`, then the terminal will disappear and `terminal.tooBig` will be set to `true`\n\n## Types\n\nA type deceleration file has been included at [`./lib/cmdDraw.d.ts`](https://github.com/liambloom/command-line-draw/blob/master/lib/cmdDraw.d.ts). I tried, but I don\u0026apos;t know typescript, so it likely has mistakes. If you find them, please report them to the github [issues page](https://github.com/liambloom/command-line-draw/issues).\n\n## More Info\n\n### Borders\n  - `'light'` **(Default)**\n  - `'heavy'`\n  - `'double'`\n  - `'round'`\n  - `'solid'`\n  - `'none'`\n\n### Colors\n  - ![#000000](https://placehold.it/15/000000?text=+) `black`\n  - ![#ff0000](https://placehold.it/15/ff0000?text=+) `red`\n  - ![#00ff00](https://placehold.it/15/00ff00?text=+) `green`\n  - ![#ffff00](https://placehold.it/15/ffff00?text=+) `yellow`\n  - ![#0000ff](https://placehold.it/15/0000ff?text=+) `blue`\n  - ![#ff00ff](https://placehold.it/15/ff00ff?text=+) `magenta`\n  - ![#00ffff](https://placehold.it/15/00ffff?text=+) `cyan`\n  - ![#ffffff](https://placehold.it/15/ffffff?text=+) `white`","funding_links":[],"categories":["JavaScript"],"sub_categories":["Node"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliambloom%2Fcommand-line-draw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliambloom%2Fcommand-line-draw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliambloom%2Fcommand-line-draw/lists"}