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 · US-NM flag SVG

svgconstant

The flag of New Mexico (ニューメキシコ州), US-NM, as an SVG string: viewBox 1800 by 1200 (3:2), 416 B. From Wikimedia Commons, "Flag of New Mexico.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/us-nm";

Definition

const svg: string = "<svg data-hata=\"us-nm\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1800 1200\"><path fill=\"gold\" d=\"M0 0h1800v1200H0z\"/><path stroke=\"#bf0a30\" stroke-linecap=\"round\" stroke-width=\"27\" d=\"M956.5 353.4v493.2m-37.7-533.1v573m-37.6-573v573m-37.7-533.1v493.2M653.4 543.5h493.2m-533.1 37.7h573m-573 37.6h573m-533.1 37.7h493.2\"/><circle cx=\"900\" cy=\"600\" r=\"93.3\" fill=\"gold\" stroke=\"#bf0a30\" stroke-width=\"13.5\"/></svg>"

Examples

Example 1

import flag from "@johnmorrisdotca/hata/flags/us-nm";

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/us-nm";
console.log(svg.startsWith("<svg"),svg.length);
true 416

What it prints (run when this page was built)

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