Skip to content

pantoken-root / plugins/pantoken/logos/src / getLogoMeta

函数: getLogoMeta() ​

getLogoMeta(product, layout?, colorMode?, lang?): LogoMeta | undefined

Beta

获取徽标的元数据,包括栅格化 PNG 的 width/height —— 适用于需要构建 dist/<name>.png 路径(例如通过 @pantoken/cdn)或在不解析 SVG 的情况下为 <img> 设定大小的使用者。

参数 ​

product ​

Product

产品。

layout? ​

LogoLayout = "horizontal"

布局(默认 "horizontal")。

colorMode? ​

LogoColorMode = "full-color"

配色(默认 "full-color")。

lang? ​

LogoLang

本地化字标的语言(如需翻译版本)。

返回值 ​

LogoMeta | undefined

SVG 字符串;如果该组合不存在,则为 undefined。

示例 ​

读取徽标的长宽比

ts
import { getLogoMeta } from "@pantoken/plugin-logos";

const meta = getLogoMeta("canvas", "horizontal", "color");
meta && meta.width / meta.height; // the logo's real aspect ratio