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

FramingCroptype

The crop of a flag at one shape: which crop fit: "auto" chooses, and the side fit: "crop" asked for by name keeps. Both the whole flag and a crop are offered for every flag: fit: "whole" shows all of it, fit: "crop" crops it.

Import it

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

Definition

interface FramingCrop {
    rule: "own" | "curated" | "centre" | "whole";
    at: "left" | "right" | "top" | "bottom" | "centre";
    why: string | null;
    loses: string[];
}

Members

NameTypeDescription
rule"whole" | "own" | "curated" | "centre"

What auto does: own (the flag is this shape, so there is nothing to crop), curated (a crop kept at at, chosen by hand and checked), centre (a crop from the centre that keeps every colour) or whole (no crop shows the flag fairly, so auto shows all of it).

at"centre" | "left" | "right" | "top" | "bottom"

The side fit: "crop" keeps: left (the hoist), right, top, bottom, or centre where nobody chose another.

whystring | null

Why a person chose this side, or chose to show the flag whole; null where nobody chose (a centre crop, or a flag that is already this shape).

losesstring[]

The colours (each covering 5% or more of the flag) that a crop at at drops: empty where it keeps them all, and explained in why where rule is curated.

Examples

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

const crop: FramingCrop | undefined = manifest("US-HI")?.framings["1:1"].crop;
console.log(crop?.rule); // "curated": a person chose the side
console.log(crop?.at);   // "left": the canton and the stripes beside it
curated
left

What it prints (run when this page was built)

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