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

defaultconstant

The flag of Chiba (千葉県), JP-12, as an SVG string: viewBox 900 by 600 (3:2), 421 B. From Wikimedia Commons, "Flag of Chiba 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 value from "@johnmorrisdotca/hata/flags/jp-12";

Definition

const svg: string = "<svg data-hata=\"jp-12\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-450 -294 900 600\"><path fill=\"#006da5\" d=\"M-450-294h900v600h-900z\"/><path fill=\"#fece60\" d=\"m0-200 40 60-40 40-40-40zL29-50l144-50L58 0l115 100L29 50 0 200-29 50l-144 50L-58 0l-115-100 144 50z\"/><path fill=\"#fff\" d=\"m0-184 28 43-22 22 16 81 110-38L26 15 0 152-26 15l-106-91 110 38 16-81-22-22zM35 20 51 6l81 70L31 41zm-70 0L-51 6l-81 70 101-35z\"/></svg>"

Examples

Example 1

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

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

What it prints (run when this page was built)

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