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

defaultconstant

The flag of Fukui (福井県), JP-18, as an SVG string: viewBox 105 by 70 (3:2), 539 B. From Wikimedia Commons, "Flag of Fukui 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-18";

Definition

const svg: string = "<svg data-hata=\"jp-18\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"-52.5 -35 105 70\"><path fill=\"#00006b\" d=\"M-52.5-35h105v70h-105z\"/><path fill=\"#fff\" d=\"M3-.58a19 19 0 0 0-3 7.25A19 19 0 0 0-3-.58V-16h6zm16.17-8a19 19 0 0 0-6.34.8 15 15 0 0 0-25.66 0 19 19 0 0 0-6.34-.8 21 21 0 0 1 38.34 0M.3 10A18 18 0 0 1 19.43-7.96 21 21 0 0 1 .3 21v-6A15 15 0 0 0 14.92-1.52a12 12 0 0 0-8.3 14.3A14.4 14.4 0 0 1 .3 14.4zm-.6 0A18 18 0 0 0-19.43-7.96 21 21 0 0 0-.3 21v-6A15 15 0 0 1-14.92-1.52a12 12 0 0 1 8.3 14.3A14.4 14.4 0 0 0-.3 14.4z\"/></svg>"

Examples

Example 1

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

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

What it prints (run when this page was built)

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