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

defaultconstant

The flag of Hokkaidō (北海道), JP-01, as an SVG string: viewBox 1260 by 840 (3:2), 830 B. From Wikimedia Commons, "Flag of Hokkaido 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-01";

Definition

const svg: string = "<svg data-hata=\"jp-01\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-630 -420 1260 840\"><path fill=\"#2f304e\" d=\"M-630-420H630v840H-630z\"/><path id=\"hata-jp-01-a\" fill=\"#fff\" d=\"m0-265 60-29V0H-60v-294z\"/><g id=\"hata-jp-01-b\"><use href=\"#hata-jp-01-a\" transform=\"rotate(51.428571428571)\"/><use href=\"#hata-jp-01-a\" transform=\"rotate(102.857142857143)\"/><use href=\"#hata-jp-01-a\" transform=\"rotate(154.285714285714)\"/></g><use href=\"#hata-jp-01-b\" transform=\"rotate(154.285714285714)\"/><path id=\"hata-jp-01-c\" fill=\"#d13a43\" d=\"M0-265 33 0h-66z\"/><g id=\"hata-jp-01-d\"><use href=\"#hata-jp-01-c\" transform=\"rotate(51.428571428571)\"/><use href=\"#hata-jp-01-c\" transform=\"rotate(102.857142857143)\"/><use href=\"#hata-jp-01-c\" transform=\"rotate(154.285714285714)\"/></g><use href=\"#hata-jp-01-d\" transform=\"rotate(154.285714285714)\"/></svg>"

Examples

Example 1

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

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

What it prints (run when this page was built)

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