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 · On-demand flag loading

LoadedFlagOntype

What flagOn() gives: FlagOnDay from /manifest (the flag of the day with other, withheld and none), and its drawing.

Import it

import type { LoadedFlagOn } from "@johnmorrisdotca/hata/load";

Definition

interface LoadedFlagOn extends FlagOnDay {
    svg: string | null;
}

Members

NameTypeDescription
svgstring | null

The drawing, framed as asked; null where there is none to give: no flag known, or a restricted one withheld (none says why).

datestring

The day asked, YYYY-MM-DD.

roleFlagRole

The role asked.

variantDatedVariant | null

The flag, or null.

noneNoFlag | null

Why there is no drawing to give; null where there is one.

Examples

import { flagOn, type LoadedFlagOn } from "@johnmorrisdotca/hata/load";

const day: LoadedFlagOn = await flagOn("CA", "1962-09-29", { shape: "4:3" });
console.log(day.variant?.id, day.variant?.other?.id); // "union-flag" "red-ensign-1957"
console.log(day.svg?.startsWith("<svg"));    // true
union-flag red-ensign-1957
true

What it prints (run when this page was built)

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