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 · Flag source and framing metadata

DatedVarianttype

Where a flag of a day is, and the other one: what variantOn gives. It is a Variant with the role that was asked, other, which says that another flag was in the other role that day and why, and withheld.

Import it

import type { DatedVariant } from "@johnmorrisdotca/hata/manifest";

Definition

interface DatedVariant extends Variant {
    role: FlagRole;
    other: OtherFlag | null;
    withheld: boolean;
}

Members

NameTypeDescription
roleFlagRole

The role that was asked, legal unless the caller said in-use.

otherOtherFlag | null

The flag of the other role on the same day where it is a different flag, with the reason and the page that says so; null where the same flag is both.

withheldboolean

True where the flag is restricted and the call did not say allowRestricted: restricted says why, and no drawing is given for it (flag() is null, <hata-flag> draws a notice).

idstring

Kebab case, unique within the place: "de-facto", "stripes", "local".

namestring

A name for a menu, in English.

nameJastring

The same in Japanese.

status"official" | "de-facto" | "historical" | "local"

Its standing: see above.

fromstring | null

When it came into use, as precisely as is known ("2021-08-15", "1953"); null where it is not known or not dated.

untilstring | null

When it went out of official use; null where it has not.

rolesFlagRole[]

Which questions this flag answers on its days: legal (the flag the law made the country's national flag) and in-use (the flag it flew as its own in practice). Most flags are both. Canada's Red Ensigns before 1965 are in-use only and its Union Flag is legal only. Empty for a de-facto or local flag, which variantOn never gives. See FlagRole.

roleDatesPartial<Record<FlagRole, { from: string | null; until: string | null; }>>

The days of each role it has, where they are not the flag's own from and until (Australia's Blue Ensign was flown from 1901 and became the national flag in law in 1954). Each role in roles has an entry.

roleNoteRoleNote | null

Why this flag is only one of the two, or is legal and in use on different days, and who says so; null where it is both on the same days.

restrictedRestricted | null

Set where the law restricts displaying the flag outside history and education: it is then not in variantsOf or any record's variants, and flag() and <hata-flag> draw it only when asked with allowRestricted. Null for every other flag. See Restricted.

whystring

Why it is offered, and (for the default) why it is the default, in a sentence or two.

sourcestring

Where the claim above is documented: a web page.

sourceKind"official" | "reference" | "encyclopedia"

What kind of page source is: official (a government, parliament, archive or law text), reference (a vexillological reference or a scholarly article) or encyclopedia (Wikipedia: a better source is wanted).

defaultboolean

True for the one flag(code) gives. At most one per place; none where the place has no flag of its own by default.

modulestring

The module that has its SVG: /flags/<module>, the place's own for the default and <code>--<id> for the others.

framesRecord<"4:3" | "1:1" | "round", "crop" | "cover" | "contain">

What frame() does with this variant's SVG at each shape by default: cover (a centre crop), crop (a crop at a chosen side) or contain (the whole flag).

drawing{ source: FlagSource; file: string; page: string; licence: { kind: LicenceKind; name: string; url: string | null; }; author: string | null; credit: string | null; attributionRequired: boolean; restrictions: string[]; uploaded: string | null; width: number; height: number; bytes: number; }

Where this drawing comes from: its Commons file, page, licence, author and size, as for a flag's record.

Examples

import { variantOn, type DatedVariant } from "@johnmorrisdotca/hata/manifest";

const found: DatedVariant | null = variantOn("CA", "1962-09-29");
console.log(found?.id);          // "union-flag": the legal flag
console.log(found?.other?.id);   // "red-ensign-1957": the flag flown in practice
console.log(found?.other?.note?.why); // "Canadians flew the Red Ensign from the 1870s …"
union-flag
red-ensign-1957
Canadians flew the Red Ensign from the 1870s and the Admiralty approved it for Canadian ships in 1892, but the government kept the Union Flag as the national flag in law until the Maple Leaf flag took over on 1965-02-15. An order in council of 1945 let the Red Ensign fly on federal buildings; it did not make it the national flag.

What it prints (run when this page was built)

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