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 · DE-BY flag SVG

defaultconstant

The flag of Bavaria (バイエルン自由州), DE-BY, as an SVG string: viewBox 1000 by 600 (5:3), 312 B. From Wikimedia Commons, "Flag of Bavaria (lozengy).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/de-by";

Definition

const svg: string = "<svg data-hata=\"de-by\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1000 600\"><path fill=\"#fff\" d=\"M0 0h1000v600H0z\"/><path fill=\"#0098d4\" d=\"M963.6 0H742.4L1000 570v30H792.4L521.2 0H300l271.2 600H350L150 157.5 0 119.3V315l128.8 285H350L0 510.8V315l1000 255V374.3L150 157.5 78.8 0H300l700 178.5V80.6z\"/></svg>"

Examples

Example 1

import flag from "@johnmorrisdotca/hata/flags/de-by";

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/de-by";
console.log(svg.startsWith("<svg"),svg.length);
true 312

What it prints (run when this page was built)

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