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 · JP-30 flag SVG

svgconstant

The flag of Wakayama (和歌山県), JP-30, as an SVG string: viewBox 90 by 60 (3:2), 239 B. From Wikimedia Commons, "Flag of Wakayama Prefecture.svg" (public domain); the /manifest entry gives its author, licence and why it was chosen. It has a viewBox and no width or height, so it fills the box it is put in at its own aspect ratio.

Import it

import { svg } from "@johnmorrisdotca/hata/flags/jp-30";

Definition

const svg: string = "<svg data-hata=\"jp-30\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-45 -30 90 60\"><path fill=\"#fff\" d=\"M-45-30h90v60h-90z\"/><path fill=\"#29437f\" d=\"M-19.36 5a20 20 0 1 1 38.72 0L0 20l-8.91-6.9L8 0A8 8 0 0 0-8 0l7.33 5.68-8.91 6.9z\"/></svg>"

Examples

Example 1

import flag from "@johnmorrisdotca/hata/flags/jp-30";

const host=document.createElement("div");
host.innerHTML = flag; // or toDataUri(flag) from "@johnmorrisdotca/hata" for an <img src>
console.log(host.querySelector("svg")?.getAttribute("viewBox"));

Example 2

import { svg } from "@johnmorrisdotca/hata/flags/jp-30";
console.log(svg.startsWith("<svg"),svg.length);
true 239

What it prints (run when this page was built)

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