Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trs/terminal-playing-cards
:spades: Generate text-based playing cards for terminals
https://github.com/trs/terminal-playing-cards
Last synced: 10 days ago
JSON representation
:spades: Generate text-based playing cards for terminals
- Host: GitHub
- URL: https://github.com/trs/terminal-playing-cards
- Owner: trs
- Created: 2018-01-08T21:54:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-08T21:54:59.000Z (almost 7 years ago)
- Last Synced: 2023-02-28T03:01:35.273Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terminal Playing Cards
> Generate playing cards in the terminal```
┌───────────┐┐┐┐┐┐ ┌───────────┐
│░░░░░░░░░░░││││││ │A │
│░░░░░░░░░░░││││││ │ │
│░░░░░░░░░░░││││││ │ │
│░░░░░░░░░░░││││││ │ ♠ │
│░░░░░░░░░░░││││││ │ │
│░░░░░░░░░░░││││││ │ │
│░░░░░░░░░░░││││││ │ A│
└───────────┘┘┘┘┘┘ └───────────┘
```# Install
```sh
$ npm install
```# Usage
```js
const {drawCard} = require('terminal-playing-cards');// rank, suit, color
const card = drawCard(10, 'hearts', 'black');
console.log(card);
/*
┌───────────┐
│10 │
│ │
│ │
│ ♡ │
│ │
│ │
│ 10│
└───────────┘
*/// height
const deck = drawDeck(-1);
console.log(deck);
/*
┌───────────┐┐
│░░░░░░░░░░░││
│░░░░░░░░░░░││
│░░░░░░░░░░░││
│░░░░░░░░░░░││
│░░░░░░░░░░░││
│░░░░░░░░░░░││
│░░░░░░░░░░░││
└───────────┘┘*/
```# CLI
```sh
$ card [color]
```- `rank`
- `"A"` through `"K"`
- `suit`
- `"diamonds"`
- `"hearts"`
- `"clubs"`
- `"spades"`
- `color` (optional)
- `"black"`
- `"red"````sh
$ deck [height]
```- `height`
- Whole number of how high the deck stack should be
- Provide a negative number for the stack to be on the right