Sub topic 2
Specifying Typography and Color
Assume you can use a design tool’s layers, frames, and components. You should also understand basic HTML and CSS. A developer needs values, rules, and states rather than screenshots alone.
Specifying typography and color
Record the font family, size, weight, line height, and letter spacing for each text style. Name styles by purpose, such as body, heading-1, or button-label, instead of naming them by appearance alone.
Define colors by role. For example, text-default, surface-primary, and action-primary remain meaningful if the visual palette changes. Use design tokens, which are named values shared by design and code.
:root {
--font-body-size: 16px;
--font-body-line-height: 1.5;
--color-text-default: #1a1a1a;
--color-action-primary: #1f5fd1;
}
.body {
font-size: var(--font-body-size);
line-height: var(--font-body-line-height);
color: var(--color-text-default);
}Check text and control colors against accessibility contrast requirements. Document whether a color is for text, an icon, a border, or a background.
Choosing asset formats
Choose the format based on the asset’s content.
| Format | Best use | Main consideration |
|---|---|---|
| SVG | Logos and simple icons | Scales without losing sharpness |
| PNG | Transparency or pixel detail | Often larger than modern alternatives |
| JPEG | Photographs without transparency | Uses lossy compression |
| WebP | Photos and many illustrations | Provide a fallback when needed |
Exporting and naming assets
Export each required size and density. A 1x file targets its CSS size; a 2x file has twice the pixel dimensions for sharper screens. Use names that describe purpose and variant, such as hero-team-800.webp and hero-team-1600.webp. Include width and height metadata where possible to reserve layout space.
Documenting component states
Show and label default, hover, focus, active, disabled, loading, error, and empty states. Explain what triggers each state and whether it changes layout. Focus must be visible for keyboard users. Loading states should describe whether controls remain usable. Error and empty states should include their message, action, and recovery path.
Handoff review
Review the file with the developer. Ask which values, assets, or behaviors remain unclear, then resolve those questions in the design file or its notes.
Exercise
A button has a normal view, a keyboard focus ring, and a disabled view. What should the handoff include?
Show answer
It should show and label each state, specify the colors and focus treatment, and explain when each state appears.