status-colors-and-errors

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Status Colours and Error Design

状态颜色与错误设计

Keep the Colour Set Small

精简颜色集合

Every status colour added to a system is a cognitive burden on the user. They must learn what each colour means, remember it, and interpret it correctly under stress — which is exactly when errors occur.
The minimal set that covers almost everything:
ColourSemantic meaningAlways means
RedError / failure / destructiveSomething went wrong, or this action cannot be undone
Orange / AmberWarningSomething needs attention before proceeding
GreenSuccess / positiveAction completed, state is healthy
BlueInfo / neutral statusInformational, no action required
Rule: each colour maps to exactly one meaning across the entire product. If orange means "warning" in one component and "pending" in another, the system breaks down.
When in doubt, cut the colour — neutral grey communicates status without semantic weight, and neutral is better than a misused semantic colour.
系统中每新增一种状态颜色,都会增加用户的认知负担。用户必须学习每种颜色的含义、记住它,并在压力下(而错误往往就发生在此时)正确解读它。
几乎能覆盖所有场景的最小颜色集合:
颜色语义含义固定含义
红色错误/失败/破坏性操作出现问题,或该操作无法撤销
橙色/琥珀色警告需在继续操作前关注相关事项
绿色成功/积极状态操作完成,状态健康
蓝色信息/中性状态仅为告知性内容,无需操作
规则:整个产品中每种颜色对应且仅对应一种含义。 如果橙色在某个组件中表示“警告”,在另一个组件中表示“待处理”,整个系统的语义就会崩溃。
若拿不定主意,就去掉该颜色——中性灰色可传达状态且无语义权重,中性颜色比误用的语义颜色更好。

Orange Is Always a Warning

橙色仅用于警告

Orange (amber) carries a specific signal: pay attention, something may go wrong. Do not use it for:
  • Neutral states (use grey)
  • Progress or pending (use blue or a spinner)
  • Informational content (use blue)
  • Branding or decorative purposes inside status indicators
If orange appears in the UI, the user should immediately know it requires their attention.
橙色(琥珀色)传递特定信号:请注意,可能会出现问题。请勿将其用于:
  • 中性状态(使用灰色)
  • 进度或待处理状态(使用蓝色或加载动画)
  • 告知性内容(使用蓝色)
  • 状态指示器内的品牌装饰用途
如果UI中出现橙色,用户应立即明白这需要他们的关注。

Errors Should Be Recoverable

错误应具备可恢复性

The worst error is one the user cannot recover from. Design every error state with a path forward.
最糟糕的错误是用户无法恢复的错误。 为每个错误状态设计解决路径。

Error message anatomy

错误消息结构

Every error should answer three questions:
  1. What went wrong? — plain language, no error codes
  2. Why did it happen? — if useful and known
  3. What should the user do next? — specific, actionable
❌ "Error 500"
❌ "Something went wrong"
✓  "We couldn't save your changes. Check your connection and try again."
✓  "This email is already in use. Sign in instead, or use a different email."
每个错误都应回答三个问题:
  1. 出了什么问题? —— 使用直白语言,不要错误代码
  2. 为什么会发生? —— 若有用且已知原因
  3. 用户接下来该怎么做? —— 具体、可执行
❌ "Error 500"
❌ "Something went wrong"
✓  "我们无法保存您的更改。请检查网络连接后重试。"
✓  "该邮箱已被使用。请登录或更换其他邮箱。"

Recovery actions

恢复操作

  • Always provide a retry button for transient failures (network errors, timeouts)
  • For validation errors, point directly to the problematic field
  • For destructive actions that failed, reassure the user nothing was lost
  • For session expiry, redirect to login and return the user to where they were
  • 针对临时故障(网络错误、超时)始终提供重试按钮
  • 对于验证错误,直接指向有问题的字段
  • 对于失败的破坏性操作,向用户确认未丢失任何内容
  • 对于会话过期,重定向至登录页面并在登录后返回用户之前的位置

Prevent Large Errors Before They Happen

提前预防重大错误

The most damaging errors — data loss, irreversible actions, broken state — should be prevented at the design level, not handled after the fact.
  • Confirm before irreversible actions: "Delete this project and all 47 tasks? This cannot be undone."
  • Disable unavailable actions rather than letting users trigger them and hit an error
  • Autosave where possible so a browser crash or accidental close does not destroy work
  • Optimistic UI with rollback: show the success state immediately, silently retry on failure, surface an error only if the retry also fails
最具破坏性的错误——数据丢失、不可撤销的操作、状态损坏——应在设计层面预防,而不是事后处理。
  • 不可撤销操作前确认: “删除此项目及所有47个任务?此操作无法撤销。”
  • 禁用不可用操作,而非让用户触发后遇到错误
  • 尽可能自动保存,避免浏览器崩溃或意外关闭导致工作成果丢失
  • 带回滚机制的乐观UI:立即显示成功状态,失败时静默重试,仅在重试也失败时才显示错误

Levels of Severity — Use Sparingly

严重程度分级——谨慎使用

Not every problem is equal. Match the visual weight of the feedback to the severity.
SeverityPatternWhen to use
Blocking errorFull-page error state or modalApp cannot continue, user must act
Inline errorRed text below a fieldForm field validation failure
Toast / snackbarTemporary notification, bottom of screenTransient failure the user should know about but can dismiss
Alert bannerPersistent bar at top of sectionOngoing issue affecting the current context
Empty stateIllustrated or descriptive empty screenNo data yet — use as an opportunity for guidance, not just a blank
Avoid showing multiple simultaneous error types at once — one clear message is more useful than three overlapping alerts.
并非所有问题的严重程度都相同。反馈的视觉权重应与严重程度匹配。
严重程度呈现方式使用场景
阻塞性错误全屏错误状态或模态框应用无法继续,用户必须采取行动
内联错误字段下方的红色文本表单字段验证失败
提示条/ snackbar屏幕底部的临时通知用户需要知晓但可忽略的临时故障
提示横幅区域顶部的持久栏影响当前上下文的持续问题
空状态带插图或描述性内容的空页面暂无数据——借此提供引导,而非仅显示空白
避免同时显示多个不同类型的错误——一条清晰的消息比三个重叠的提示更有用。

Review Checklist

审查清单

  • Does the product use four or fewer semantic status colours?
  • Does each colour mean exactly one thing, used consistently everywhere?
  • Is orange/amber reserved exclusively for warnings?
  • Does every error message state what went wrong and what to do next?
  • Do all transient errors (network, timeout) have a retry action?
  • Are irreversible destructive actions protected by a confirmation step?
  • Is autosave or draft recovery available for long-form or complex inputs?
  • Are multiple simultaneous error states avoided?
  • 产品是否使用四种或更少的语义状态颜色?
  • 每种颜色是否有且仅有一种含义,且在所有场景中保持一致?
  • 橙色/琥珀色是否仅用于警告?
  • 每个错误消息是否说明问题所在及后续操作?
  • 所有临时错误(网络、超时)是否都有重试操作?
  • 不可撤销的破坏性操作是否有确认步骤保护?
  • 长文本或复杂输入是否支持自动保存或草稿恢复?
  • 是否避免了同时显示多个错误状态?

Common Anti-Patterns

常见反模式

Anti-patternProblemFix
"Something went wrong" with no actionUser is stuck with no path forwardAdd specific cause and a retry or contact link
Orange used for "pending" and "warning" simultaneouslyColour loses its meaningOrange = warning only; use blue or spinner for pending
Five or more status colours (red, orange, yellow, teal, purple…)User must learn and remember a complex legendCut to the minimum: red, orange, green, blue
Inline validation only on submitUser discovers all errors at onceValidate on blur (leaving a field) for immediate feedback
No confirmation on deleteUsers accidentally delete dataRequire explicit confirmation for all irreversible actions
反模式问题修复方案
“出了点问题”但无任何操作选项用户陷入困境,无路可走添加具体原因及重试或联系链接
同时将橙色用于“待处理”和“警告”颜色失去语义橙色仅用于警告;待处理状态使用蓝色或加载动画
使用五种或更多状态颜色(红、橙、黄、青、紫……)用户必须学习并记住复杂的图例精简至最小集合:红、橙、绿、蓝
仅在提交时进行内联验证用户一次性发现所有错误在字段失焦时验证,提供即时反馈
删除操作无确认步骤用户意外删除数据所有不可撤销操作都需明确确认