Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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