Skip to content

pantoken / plugins/pantoken/logos/src / getLogoDataUri

Hàm: getLogoDataUri()

getLogoDataUri(product, layout?, colorMode?, lang?): string | undefined

Beta

Lấy logo dưới dạng URI data:image/svg+xml base64.

Tham số

product

Product

Sản phẩm.

layout?

LogoLayout = "horizontal"

Bố cục (mặc định "horizontal").

colorMode?

LogoColorMode = "full-color"

Phối màu (mặc định "full-color").

lang?

LogoLang

Ngôn ngữ của wordmark được bản địa hóa, nếu muốn một biến thể đã được dịch.

Trả về

string | undefined

URI dữ liệu, hoặc undefined nếu kết hợp đó không tồn tại.

Ví dụ

Sử dụng logo làm thuộc tính src của <img>

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

const uri = getLogoDataUri("mastery", "icon", "color");
const img = document.createElement("img");
if (uri) img.src = uri;