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-38 flag SVG

svgconstant

The flag of Ehime (愛媛県), JP-38, as an SVG string: viewBox 300 by 200 (3:2), 615 B. From Wikimedia Commons, "Flag of Ehime 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-38";

Definition

const svg: string = "<svg data-hata=\"jp-38\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 300 200\"><path fill=\"#0e6d46\" d=\"M0 40h300v120H0z\"/><path fill=\"#fff\" d=\"M120 50s-11 7.5-11.8 36.4c-27.7-8.3-38.2-.1-38.2-.1s3.7 12.8 31 22.4c-16.5 23.9-12 36.4-12 36.4s13.3.5 30.9-22.6c17.6 23 30.9 22.6 30.9 22.6s4.6-12.6-11.9-36.4c27.3-9.6 31-22.4 31-22.4s-10.5-8.2-38.2.1C131 57.4 120 50 120 50\"/><path fill=\"#ffa600\" d=\"M120 86.5a16 16 0 0 0-16 16 16 16 0 0 0 16 16.1 16 16 0 0 0 16-16 16 16 0 0 0-16-16m0 5.4a10.7 10.7 0 0 1 10.7 10.6c0 6-4.8 10.8-10.7 10.8s-10.7-4.9-10.7-10.8A10.7 10.7 0 0 1 120 92M0 0h300v40H0zm0 160h300v40H0z\"/></svg>"

Examples

Example 1

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

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-38";
console.log(svg.startsWith("<svg"),svg.length);
true 615

What it prints (run when this page was built)

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