跳到正文

手动模式

手动模式开放了引擎接受的所有参数。编辑器界面和 API 中提供的是同一套控件。

7 个关键参数

即使其他都不改,以下几项也最为重要:

  1. content:要编码的 URL 或文本。
  2. primaryColor + backgroundColor:必须保持 ≥ 4:1 的对比度。
  3. eccLevel:L / M / Q / H。默认 H。有 logo 时必须使用 H。
  4. moduleShape:square / circle / roundedsquare / diamond / hexagon / dot / cross / star / leaf / pointed / drop。
  5. finderOuterShape + finderInnerShape:3 个角上的图案。求稳选 square 或 roundedsquare;追求设计感选 circle / target / double。
  6. outputWidth + pixelsPerModule:二选一,另一个会自动计算。
  7. fileFormat:png、jpg、svg、pdf、webp。

渐变

{
  "foregroundStyle": "linearGradient",
  "gradientColors": ["#dcc28a", "#7d4bff"],
  "gradientDirection": "diagonal"
}

gradientDirection 可取 vertical、horizontal、diagonal、diagonal-reverse、radial 或 custom(配合 gradientAngle: 0-360)。

{
  "logoUrl": "https://yourbrand.com/logo.svg",
  "logoShape": "circle",
  "logoSizePercent": 18,
  "cleanBehindLogo": true,
  "eccLevel": "H"
}

logoSizePercent 上限为 25,以确保纠错能力仍在可恢复范围内。

边框和文字叠加

{
  "frame": {
    "enabled": true,
    "color": "#3d2a14",
    "width": 6,
    "cornerRadius": 14,
    "padding": 18,
    "shape": "rectangle"
  },
  "centerText": {
    "text": "ADMIT ONE",
    "color": "#3d2a14",
    "backgroundColor": "#f5ecd2",
    "height": 28,
    "fontSize": 13,
    "bold": true
  },
  "ctaText": "Scan to enter"
}

三者组合(边框 + 中心横幅 + 下方 CTA)正是引擎在票券横幅展示卡片中演示的效果。

完整参数列表

请参阅 QrConfig 参考。它由引擎使用的同一套模型自动生成,因此始终保持同步。