Reference · Game engine and table
hitotsuCardSvgfunction
A whole card as an SVG document, width pixels wide (140/100 of it tall): a face, or the back for null.
Import it
import { hitotsuCardSvg } from "@johnmorrisdotca/hitotsu";
Definition
function hitotsuCardSvg(card: HitotsuCard | null, { width, called, title }?: { width?: number; called?: HitotsuColour; title?: string; }): string
Parameters
| Name | Type | Description |
|---|---|---|
card | string | null | The physical card id; null draws the back where supported. |
options (optional) | { width?: number; called?: HitotsuColour; title?: string; } | Native table, rules, sound or drawing settings; omitted fields retain their defaults. |
Returns
string
The complete SVG document for the card or its back.
Examples
import { hitotsuCardSvg } from "@johnmorrisdotca/hitotsu";
console.log(hitotsuCardSvg("R70", { width: 80, title: "Red seven" }).slice(0, 120));<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 140" width="80" height="112" role="img" aria-label="Red seven">What it prints (run when this page was built)