返回提示词目录第 1492 页

制定界面字体层级与设计令牌

为产品建立字体角色、字号比例和响应式规则,输出设计令牌与代码示例,并规划现有样式迁移。

完整提示词

<context>
A UI type scale fails in predictable ways. Teams name styles after HTML levels (`h1` to `h6`), so a card title that must be an `h3` for document structure cannot look small, and visual size gets tied to semantics. Role names (display, headline, title, body, label, caption) with size steps fix that: the heading level is chosen in markup, the style by role. A mathematical ratio (1.125 to 1.333) gives a coherent start, but dense product UI needs small steps at the bottom and larger jumps only at display sizes, so ratios get rounded and adjusted by hand. Line heights should be unitless in CSS, tighter for large text (about 1.1 to 1.3) and looser for body text (about 1.4 to 1.6), and resolve to whole pixels on the spacing grid so baselines and component heights line up. Large sizes usually need slightly negative letter spacing. Sizes belong in `rem` on the web so user font settings work, and fluid `clamp()` sizes must keep a `rem` part, or text stops scaling with browser zoom and fails WCAG 1.4.4 Resize Text. Native platforms have their own systems: iOS Dynamic Type text styles and Android `sp` units with the user's font scale, which the tokens should map to, not override. Every weight in the scale must be a weight that is actually loaded, or browsers synthesise a fake bold.
</context>

<task>
Define the type scale for this product as tokens.

<product>
{{product}}
</product>

<fonts>
{{fonts}}
</fonts>
{{#current}}

<current>
{{current}}
</current>
{{/current}}

1. **Scale rationale.** Choose a base body size (16px on the web unless the product gives a reason) and a ratio or hand-tuned set of steps. Explain the choice for this product's density, and keep the total number of sizes small (usually 8 to 12).
2. **Type roles.** A table of roles and sizes (for example `display-lg`, `headline-md`, `title-sm`, `body-md`, `label-sm`, `caption`), each with font family, size in px and rem, line height (unitless and resolved px), weight, letter spacing, and intended use. Say which roles may be used with which heading levels and that heading level is set in markup.
3. **Responsive behaviour.** Say which roles change across breakpoints. Give either stepped values per breakpoint or `clamp()` formulas that keep a `rem` term, with the minimum and maximum. Body and label sizes should normally stay fixed.
4. **Tokens and code.** Primitive tokens (font families, sizes, line heights, weights, tracking) and composite role tokens that reference them, in the W3C design tokens format (`$type: typography`) or the user's existing token format, plus a CSS excerpt with custom properties and one utility class or mixin per role. If iOS or Android are in scope, map each role to the nearest Dynamic Type text style and to `sp` values.
5. **Design-file styles.** The text styles to create in the design tool, named to match the tokens, and which values should be bound to variables.
6. **Migration from current.** If current sizes are given, map each to the nearest new role, list sizes that disappear, and flag places where the change is visible (more than 2px).
7. Check every weight used against the loaded weights and every line height against the spacing base unit; report any mismatch.
</task>

<constraints>
- Use only the given typefaces and weights; propose new weights only as a marked option with the cost of loading them.
- Do not size text in px only on the web, and do not use viewport units without a rem term.
- Do not invent current values or analytics; mark every proposal as proposed.
{{> output/uncertainty}}
</constraints>

<output_format>
Markdown with the sections from the contract, in order. Roles and migration as tables, tokens and CSS in fenced code blocks. End with Open questions.
</output_format>

可替换内容

  • {{product}}
  • {{fonts}}
  • {{#current}}
  • {{current}}
  • {{/current}}
  • {{> output/uncertainty}}

分类与标签

设计创意、字体规范、设计系统、界面排版

前往 AI 图片创作