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

Varianttype

One of a place's flags in real use, for flag(code, { variant }) and variantsOf(code): Afghanistan's Republic tricolour and the Taliban's flag, Bavaria's lozenges and stripes, Guadeloupe's French tricolour and its local flag.

  • official: adopted by the authority that has the right to.
  • de-facto: flown by whoever holds the territory, without that recognition.
  • historical: no longer official, and still flown.
  • local: in use there, and not made the place's own flag by its authority.

Import it

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

Definition

interface Variant {
    id: string;
    name: string;
    nameJa: string;
    status: "official" | "de-facto" | "historical" | "local";
    from: string | null;
    until: string | null;
    why: string;
    source: string;
    default: boolean;
    module: string;
    frames: Record<"4:3" | "1:1" | "round", "cover" | "crop" | "contain">;
    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;
    };
}

Members

NameTypeDescription
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.

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.

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 { variantsOf, type Variant } from "@johnmorrisdotca/hata/manifest";

const taliban: Variant | undefined = variantsOf("AF").find((one) => one.status === "de-facto");
console.log(taliban?.id);     // "de-facto"
console.log(taliban?.from);   // "2021-08-15"
console.log(taliban?.module); // "af--de-facto": import it from "@johnmorrisdotca/hata/flags/af--de-facto"
de-facto
2021-08-15
af--de-facto

What it prints (run when this page was built)

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