svg定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The flag of Uzbekistan (ウズベキスタン), UZ, as an SVG string: viewBox 1000 by 500 (2:1), 1.2 KB. From Wikimedia Commons, "Flag of Uzbekistan.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 { svg } from "@johnmorrisdotca/hata/flags/uz";
定義
const svg: string = "<svg data-hata=\"uz\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1000 500\"><path fill=\"#1eb53a\" d=\"M0 0h1000v500H0z\"/><path fill=\"#0099b5\" d=\"M0 0h1000v250H0z\"/><path fill=\"#ce1126\" d=\"M0 160h1000v180H0z\"/><path fill=\"#fff\" d=\"M0 170h1000v160H0z\"/><circle cx=\"140\" cy=\"80\" r=\"60\" fill=\"#fff\"/><circle cx=\"160\" cy=\"80\" r=\"60\" fill=\"#0099b5\"/><g fill=\"#fff\" transform=\"matrix(2 0 0 2 272 128)\"><g id=\"hata-uz-e\"><g id=\"hata-uz-d\"><g id=\"hata-uz-c\"><g id=\"hata-uz-b\"><path id=\"hata-uz-a\" d=\"M0-6v6h3\" transform=\"rotate(18 0 -6)\"/><use width=\"100%\" height=\"100%\" href=\"#hata-uz-a\" transform=\"scale(-1 1)\"/></g><use width=\"100%\" height=\"100%\" href=\"#hata-uz-b\" transform=\"rotate(72)\"/></g><use width=\"100%\" height=\"100%\" href=\"#hata-uz-b\" transform=\"rotate(-72)\"/><use width=\"100%\" height=\"100%\" href=\"#hata-uz-c\" transform=\"rotate(144)\"/></g><use width=\"100%\" height=\"100%\" y=\"-24\" href=\"#hata-uz-d\"/><use width=\"100%\" height=\"100%\" y=\"-48\" href=\"#hata-uz-d\"/></g><use width=\"100%\" height=\"100%\" x=\"24\" href=\"#hata-uz-e\"/><use width=\"100%\" height=\"100%\" x=\"48\" href=\"#hata-uz-e\"/><use width=\"100%\" height=\"100%\" x=\"-48\" href=\"#hata-uz-d\"/><use width=\"100%\" height=\"100%\" x=\"-24\" href=\"#hata-uz-d\"/><use width=\"100%\" height=\"100%\" x=\"-24\" y=\"-24\" href=\"#hata-uz-d\"/></g></svg>"
例
例 1
import flag from "@johnmorrisdotca/hata/flags/uz";
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"));例 2
import { svg } from "@johnmorrisdotca/hata/flags/uz";
console.log(svg.startsWith("<svg"),svg.length);true 1274出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。