Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Card designs

cardFaceUrlfunction

A card's face as a data URL, for an <img src>, a CSS background or a canvas. null for anything that is not a card.

Import it

import { cardFaceUrl } from "@johnmorrisdotca/toranpu/card-faces";

Definition

function cardFaceUrl(card: string, options?: CardFaceOptions): string | null

Parameters

NameTypeDescription
cardstring

The physical card or card id to read, draw or play.

options (optional)CardFaceOptions

Options for this call; omitted fields retain their documented defaults.

Returns

string | null

A card's face as a data URL, for an <img src>, a CSS background or a canvas. null for anything that is not a card.

Examples

import { cardFaceUrl } from "@johnmorrisdotca/toranpu/card-faces";

console.log(cardFaceUrl("KH")?.slice(0, 40));
data:image/svg+xml;charset=utf-8,%3Csvg%

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.