本文へ移動

Hata旗

国や地域の旗を読み込み、対応する表示の形を選び、絵ごとの資料・作者・ライセンスを保てます。

「旗(はた)」は、旗を表す日本語です。 名前について(英語)

目次

リファレンス · 旗の資料と表示の情報

FlagRecord型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Where one flag's drawing comes from, under what licence, and why that drawing was chosen.

インポート

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

定義

interface FlagRecord {
    code: string;
    source: FlagSource;
    file: string;
    page: string;
    version: string | null;
    wikidata: string;
    licence: {
        kind: LicenceKind;
        name: string;
        url: string | null;
    };
    author: string | null;
    credit: string | null;
    attributionRequired: boolean;
    restrictions: string[];
    templates: string[];
    uploaded: string | null;
    fetched: string;
    reference: {
        file: string;
        page: string;
        licence: string;
    } | null;
    why: string;
    sameAs: string | null;
    width: number;
    height: number;
    bytes: number;
    gzip: number;
    notes: string[];
    disputed: boolean;
    defaultVariant: string | null;
    variants: Variant[];
    framings: Record<"4:3" | "1:1" | "round", Framing>;
}

メンバー

名前型説明
codestring

The code, as Kuni writes it: "JP", "JP-13", "CA-ON", "US-TX".

sourceFlagSource

Where the drawing comes from: commons, flag-icons or country-flag-icons.

filestring

The file: its name on Commons without "File:", or its path in the flag set ("3x2/YE.svg").

pagestring

Where to see it: the file's page on Commons, with its licence and history, or the set's file on jsDelivr at its version.

versionstring | null

The flag set's version the drawing is from; null for Commons.

wikidatastring

The Wikidata item whose flag image (P41) names the file: "Q17".

licence{ kind: LicenceKind; name: string; url: string | null; }

The licence: its kind, its name ("Public domain", "CC BY 4.0", "MIT") and its address where it has one.

authorstring | null

The author: as Commons' Artist field gives it, in plain text, or the set's copyright line; null where none is named.

creditstring | null

The credit line Commons gives, in plain text; null where there is none.

attributionRequiredboolean

True where the licence asks for credit (Commons says so, or the set's MIT notice must travel with it).

restrictionsstring[]

Restrictions Commons notes on the flag apart from copyright, as it spells them: "insignia", "trademarked".

templatesstring[]

The licence and restriction templates on the Commons file's page, without "Template:"; empty for a set's drawing.

uploadedstring | null

The day the Commons file's current version was uploaded, YYYY-MM-DD; null for a set's drawing.

fetchedstring

The day Wikidata and Commons were read for this package, YYYY-MM-DD.

reference{ file: string; page: string; licence: string; } | null

Where the drawing is a set's: the Commons file Wikidata names, which it was compared with, and that file's licence. Null for Commons.

whystring

Why this drawing was chosen over the others, in a sentence or two.

sameAsstring | null

The code whose picture this is, where two places fly one flag (Bouvet Island flies Norway's); null otherwise.

widthnumber

The viewBox's width: the flag's aspect ratio is width / height.

heightnumber

The viewBox's height.

bytesnumber

The size of the optimised SVG, in bytes.

gzipnumber

Its size gzipped at level 9, in bytes.

notesstring[]

Things worth knowing about the picture: text drawn with a font, an embedded raster picture.

disputedboolean

True where more than one authority or community claims the place's flag at the same time (Afghanistan, Northern Ireland); this package takes no side, and says why each default was chosen (README).

defaultVariantstring | null

The id of the variant flag(code) gives; null where the place has one flag (variants is then empty) or none of its own by default.

variantsVariant[]

Every flag of the place in real use, the default's included, each with its status and reason; empty where the place has one flag. See Variant.

framingsRecord<"4:3" | "1:1" | "round", Framing>

How the flag is framed at 4:3, square and round by flag(code, { shape }), and by frame(); see Framing.

例

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

const tokyo: FlagRecord | null = manifest("JP-13");
if (tokyo !== null) console.log(tokyo.page, tokyo.licence.name, tokyo.width / tokyo.height);
https://commons.wikimedia.org/wiki/File:Flag_of_Tokyo_Metropolis.svg Public domain 1.5

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/hata 1.6.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。