Skip to the content

Hata旗

Load a native country or region flag, choose supported framing and keep each drawing’s source, author and licence.

Hata (旗) is Japanese for a flag. About the name

Contents

Reference · Samurai battle banners

samuraiFlagfunction

A banner as an SVG string: it has a viewBox and no width or height, a tall nobori, a flag or the sign of a commander. frame() and toDataUri() from the main entry take it like any other.

Import it

import { samuraiFlag } from "@johnmorrisdotca/hata/samurai";

Definition

function samuraiFlag(id: string): Promise<string | null>

Parameters

NameTypeDescription
idstring

A banner's id, in any case, with or without samurai:.

Returns

Promise<string | null>

The SVG string, loaded when it is asked for (the drawing is a module of its own, so a page carries only the drawings it asks for), or null when the set has no such banner.

Examples

import { toDataUri } from "@johnmorrisdotca/hata";
import { samuraiFlag } from "@johnmorrisdotca/hata/samurai";

const nobori = await samuraiFlag("samurai:sanada-rokumonsen"); // "<svg …>"
console.log(nobori === null ? null : toDataUri(nobori)?.startsWith("data:image/svg+xml,"));
true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hata 1.31.0.