{"id":13623382,"url":"https://github.com/ayonious/console-table-printer","last_synced_at":"2025-05-15T02:10:26.973Z","repository":{"id":34081470,"uuid":"166671225","full_name":"ayonious/console-table-printer","owner":"ayonious","description":"🖥️  🍭 Printing Pretty Tables on your console","archived":false,"fork":false,"pushed_at":"2025-05-05T21:48:40.000Z","size":2291,"stargazers_count":185,"open_issues_count":28,"forks_count":22,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T22:39:04.939Z","etag":null,"topics":["console","consolelog","opensource","opensource-library","tables"],"latest_commit_sha":null,"homepage":"https://console-table.netlify.app","language":"TypeScript","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/ayonious.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2019-01-20T14:34:17.000Z","updated_at":"2025-05-02T17:23:34.000Z","dependencies_parsed_at":"2023-02-18T10:46:06.470Z","dependency_job_id":"43adf604-3a9d-4760-b05d-a77178e9406f","html_url":"https://github.com/ayonious/console-table-printer","commit_stats":{"total_commits":419,"total_committers":13,"mean_commits":32.23076923076923,"dds":0.532219570405728,"last_synced_commit":"6348031a3bfafcd1b7dfc5c888b1e8d4516ad5f8"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fconsole-table-printer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fconsole-table-printer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fconsole-table-printer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayonious%2Fconsole-table-printer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayonious","download_url":"https://codeload.github.com/ayonious/console-table-printer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590372,"owners_count":21772934,"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":["console","consolelog","opensource","opensource-library","tables"],"created_at":"2024-08-01T21:01:31.131Z","updated_at":"2025-05-15T02:10:26.843Z","avatar_url":"https://github.com/ayonious.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003econsole-table-printer\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003e🖥️🍭Printing Pretty Tables on your console\u003c/h3\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://codecov.io/gh/ayonious/console-table-printer\"\u003e\n    \u003cimg alt=\"codecov\" src=\"https://codecov.io/gh/ayonious/console-table-printer/branch/master/graph/badge.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://badge.fury.io/js/console-table-printer\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/console-table-printer.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://packagephobia.now.sh/result?p=console-table-printer\"\u003e\n    \u003cimg alt=\"install size\" src=\"https://packagephobia.now.sh/badge?p=console-table-printer@latest\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/prettier/prettier\"\u003e\n    \u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=plastic\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/semantic-release/semantic-release\"\u003e\n    \u003cimg alt=\"semantic-release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Synopsis\n\nPrinting Simple Table with Coloring rows on your console. Its useful when you want to present some tables on console using js.\n\n## Installation\n\n```bash\nnpm install console-table-printer --save\n```\n\n## Basic Example\n\n```javascript\nconst { printTable } = require('console-table-printer');\n\n//Create a table\nconst testCases = [\n  { Rank: 3, text: 'I would like some Yellow', value: 100 },\n  { Rank: 4, text: 'I hope batch update is working', value: 300 },\n];\n\n//print\nprintTable(testCases);\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/readme-quick-1.png)\n\n## 🚨🚨Announcement🚨🚨 Official Documentation is moved [Here](https://console-table.netlify.app/docs)\n\nYou can also create a Table instance and print it:\n\n```javascript\nconst { Table } = require('console-table-printer');\n\n//Create a table\nconst p = new Table();\n\n// add rows with color\np.addRow({ Record: 'a', text: 'red wine please', value: 10.212 });\np.addRow({ Record: 'b', text: 'green gemuse please', value: 20.0 });\np.addRows([\n  // adding multiple rows are possible\n  { Record: 'c', text: 'gelb bananen bitte', value: 100 },\n  { Record: 'd', text: 'update is working', value: 300 },\n]);\n\n//print\np.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/readme-instance-1.png)\n\nYou can also put some color to your table like this:\n\n```javascript\nconst p = new Table();\np.addRow({ description: 'red wine', value: 10.212 }, { color: 'red' });\np.addRow({ description: 'green gemuse', value: 20.0 }, { color: 'green' });\np.addRow({ description: 'gelb bananen', value: 100 }, { color: 'yellow' });\np.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/readme-color-1.png)\n\nYou can also put properties based on columns (color/alignment/title)\n\n```javascript\nconst p = new Table({\n  columns: [\n    { name: 'id', alignment: 'left', color: 'blue' }, // with alignment and color\n    { name: 'text', alignment: 'right' },\n    { name: 'is_priority_today', title: 'Is This Priority?' }, // with Title as separate Text\n  ],\n  colorMap: {\n    custom_green: '\\x1b[32m', // define customized color\n  },\n});\n\np.addRow({ id: 1, text: 'red wine', value: 10.212 }, { color: 'green' });\np.addRow(\n  { id: 2, text: 'green gemuse', value: 20.0 },\n  { color: 'custom_green' } // your green\n);\np.addRow(\n  { id: 3, text: 'gelb bananen', value: 100, is_priority_today: 'Y' },\n  { color: 'yellow' }\n);\np.addRow({ id: 3, text: 'rosa hemd wie immer', value: 100 }, { color: 'cyan' });\n\np.printTable();\n```\n\n![Screenshot](https://cdn.jsdelivr.net/gh/ayonious/console-table-printer@master/static-resources/readme-columns-1.png)\n\n## CLI\n\nThere is also a CLI tool for printing Tables on Terminal directly [table-printer-cli](https://www.npmjs.com/package/table-printer-cli)\n\n## Documentation\n\nOfficial documentation has been moved here: [console-table-documentation](https://console-table.netlify.app)\n\n### Table instance creation\n\n3 ways to Table Instance creation:\n\n1. Simplest way `new Table()`\n\n2. Only with column names: `new Table(['column1', 'column2', 'column3'])`\n\n3. Detailed way of creating table instance\n\n```javascript\nnew Table({\n  title: 'Title of the Table', // A text showsup on top of table (optoinal)\n  columns: [\n    { name: 'column1', alignment: 'left', color: 'red' }, // with alignment and color\n    { name: 'column2', alignment: 'right', maxLen: 30 }, // lines bigger than this will be splitted in multiple lines\n    { name: 'column3', title: 'Column3' }, // Title is what will be shown while printing, by default title = name\n  ],\n  rows: [{ column1: 'row1' }, { column2: 'row2' }, { column3: 'row3' }],\n  sort: (row1, row2) =\u003e row2.column1 - row1.column1, // sorting order of rows (optional), this is normal js sort function for Array.sort\n  filter: (row) =\u003e row.column1 \u003c 3, // filtering rows (optional)\n  enabledColumns: ['column1'], // array of columns that you want to see, all other will be ignored (optional)\n  disabledColumns: ['column2'], // array of columns that you DONT want to see, these will always be hidden\n  colorMap: {\n    custom_green: '\\x1b[32m', // define customized color\n  },\n  charLength: {\n    '👋': 2,\n    '😅': 2,\n  }, // custom len of chars in console\n});\n```\n\n### Functions\n\n- `addRow(rowObjet, options)` adding single row. This can be chained\n- `addRows(rowObjects, options)` adding multiple rows. array of row object. This case options will be applied to all the objects in row\n- `addColumn(columnObject)` adding single column\n- `addColumns(columnObjects)` adding multiple columns\n- `printTable()` Prints the table on your console\n\n### possible `color` values for rows\n\nCheck Docs: [color-vals](https://console-table.netlify.app/docs/doc-color)\n\nExample usage: To Create a row of color blue\n\n```js\ntable.addRow(rowObject, { color: 'blue' });\n```\n\nExample usage: To apply blue for all rows\n\n```js\ntable.addRows(rowsArray, { color: 'blue' });\n```\n\n### possible `alignment` values for columns\n\nCheck Docs: [alignment-vals](https://console-table.netlify.app/docs/doc-alignment)\n\n### Typescript Support\n\nYou can get color / alignment as types. Check Docs: [types-docs](https://console-table.netlify.app/docs/doc-typescript)\n\n## License\n\n[MIT](https://github.com/ayonious/console-table-printer/blob/master/LICENSE)\n","funding_links":[],"categories":["TypeScript","Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayonious%2Fconsole-table-printer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayonious%2Fconsole-table-printer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayonious%2Fconsole-table-printer/lists"}