svgconstant
The flag of Cook Islands (クック諸島), CK, as an SVG string: viewBox 9600 by 4800 (2:1), 1.1 KB. From Wikimedia Commons, "Flag of the Cook Islands.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/ck";
Definition
const svg: string = "<svg data-hata=\"ck\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 9600 4800\"><title>Flag of the Cook Islands</title><defs><clipPath id=\"hata-ck-a\"><path d=\"M0 0h12v6H0z\"/></clipPath><clipPath id=\"hata-ck-b\"><path d=\"M0 0v1.5h8V4zm6 0H3v4h-5z\"/></clipPath></defs><g fill=\"#012169\" stroke-width=\".6\" clip-path=\"url(#hata-ck-a)\" transform=\"scale(800)\"><path d=\"M0 0h12v6H0z\"/><path stroke=\"#fff\" d=\"m0 0 6 3M0 3l6-3\"/><path stroke=\"#c8102e\" stroke-width=\".4\" d=\"m0 0 6 3M0 3l6-3\" clip-path=\"url(#hata-ck-b)\"/><path stroke=\"#fff\" stroke-width=\"1\" d=\"M3 0v4M0 1.5h7\"/><path stroke=\"#c8102e\" d=\"M3 0v4M0 1.5h7\"/><path d=\"M0 3h6V0h6v6H0z\"/></g><g transform=\"translate(7200,2400)\"><g id=\"hata-ck-d\"><path id=\"hata-ck-c\" fill=\"#fff\" d=\"m0-1992 81 249h261l-211 153 81 249L0-1494l-212 153 81-249-211-153h261z\"/><use href=\"#hata-ck-c\" transform=\"rotate(24)\"/><use href=\"#hata-ck-c\" transform=\"rotate(48)\"/></g><use href=\"#hata-ck-d\" transform=\"rotate(72)\"/><use href=\"#hata-ck-d\" transform=\"rotate(144)\"/><use href=\"#hata-ck-d\" transform=\"rotate(216)\"/><use href=\"#hata-ck-d\" transform=\"rotate(288)\"/></g></svg>"
Examples
Example 1
import flag from "@johnmorrisdotca/hata/flags/ck";
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/ck";
console.log(svg.startsWith("<svg"),svg.length);true 1101What it prints (run when this page was built)