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

svgconstant

The flag of Ōsaka (大阪府), JP-27, as an SVG string: viewBox 30 by 20 (3:2), 559 B. From Wikimedia Commons, "Flag of Osaka 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-27";

Definition

const svg: string = "<svg data-hata=\"jp-27\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-15 -10 30 20\"><path fill=\"#33419a\" d=\"M-15-10h30v20h-30z\"/><g id=\"hata-jp-27-b\"><circle id=\"hata-jp-27-a\" cx=\"6\" r=\"2\" fill=\"none\" stroke=\"#fff\" stroke-width=\"2\"/><use href=\"#hata-jp-27-a\" transform=\"rotate(120 2 0)\"/></g><use href=\"#hata-jp-27-b\" transform=\"rotate(180)\"/><path id=\"hata-jp-27-c\" fill=\"#fff\" d=\"M6 0a1 1 0 0 0 0 1.7H3A1 1 0 0 0 3 0z\" transform=\"rotate(60 3 0)\"/><use href=\"#hata-jp-27-c\" transform=\"rotate(120 2 0)\"/><use href=\"#hata-jp-27-c\" transform=\"scale(-1 1)\"/></svg>"

Examples

Example 1

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

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

What it prints (run when this page was built)

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