算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
color【设计与创意】Use this skill whenever color decisions matter — picking the brand primary, defining a neutral ramp, designing status semantics (success/warning/error), choosing chart palettes, selecting accent hues, supporting dark mode, ensuring colorblind-safe contrast, or auditing an existing UI for color noise. Trigger when stakeholders argue about palette, whe…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Color attracts attention, groups related elements, signals meaning, and shapes aesthetic response. Used deliberately, it carries information at a glance and unifies a product. Used carelessly, it adds noise, fails accessibility, and means different things to different audiences. Among visual variables, color is the loudest and the most easily abused.
Color performs four jobs in design: it draws the eye to elements that matter (attention), it visually unifies elements that belong together (grouping), it carries categorical or semantic information (meaning — green is success, red is danger), and it shapes the aesthetic register of the design (a saturated palette feels energetic; a muted one feels serious). Each color you introduce to a design takes on one or more of these roles; designs that use color promiscuously dilute every role. The discipline is in the restraint: a small palette, used consistently, with each color earning its place.
A saturated, distinct color in a sea of neutrals draws the eye. This is the basis for primary CTAs, error states, and emphasis. The mechanism is preattentive: a single colored item among uncolored items "pops out" within ~200ms.
The economy: attention only works when sparse. A page where every element is colored loses the pop-out advantage entirely.
Items that share a color read as related. This underlies status systems (all overdue items in red), category coding (all marketing dashboards in blue), and brand identity (all of this product's surfaces share this hue).
Use this for meaningful relationships, not for decoration.
Color carries semantic content when it's used consistently and conventionally. In Western contexts: red = danger / stop / error; green = go / success; yellow = warning. These conventions are partly cultural (red signals luck in much of East Asia; green is unlucky in some contexts), so global products should pair color with non-color signals.
Color shapes mood. Saturated palettes feel energetic; muted palettes feel calm or serious. Warm colors (yellow, orange, red) feel active; cool colors (blue, green, purple) feel stable. These associations are partly biological (warm colors attract attention faster) and partly cultural.
A useful rule: limit your active palette to ~5 colors that the user must recognize.
Brand primary — 1 hue
Neutrals — a ramp from dark to light (~9 stops)
Success — 1 hue (typically green)
Warning — 1 hue (typically yellow / amber)
Destructive — 1 hue (typically red)
Beyond this, every additional hue dilutes the system. Charts and data visualizations may need 5–8 categorical colors, but those are exceptions; the interface chrome should stay restrained.
Common harmony patterns (from the color wheel):
For UI work, monochromatic + neutrals + a few semantic accents is the workhorse. Complementary and triadic palettes look striking but require more care to balance.
Saturation (chromatic intensity) is color's volume knob.
A common UI mistake: saturated colors everywhere. The page becomes loud; nothing stands out. The fix: pull saturation down on most surfaces; reserve full saturation for moments.
Color symbolism is not universal. Examples:
For global products: don't rely on color symbolism alone. Pair color with text, icons, and position so the meaning carries across audiences.
WCAG 1.4.1 codifies what's also a basic usability principle: color must not be the only means of conveying information. About 8% of men have red-green color blindness; achievement of WCAG 1.4.1 requires that any color signal be paired with a non-color signal.
Practical applications:
aria-required, not just red label.This isn't only for color-blind users; it serves anyone in glare, on a printed copy, in low contrast, or with degraded vision.
Foreground/background contrast ratios (relative luminance):
| Content type | Level AA | Level AAA |
|---|---|---|
| Body text (< 18pt regular or < 14pt bold) | 4.5:1 | 7:1 |
| Large text (≥ 18pt regular or ≥ 14pt bold) | 3:1 | 4.5:1 |
| UI components and graphical objects | 3:1 | (no AAA) |
Common failures:
#999 on white = 2.85:1 — fails).#1e90ff on white = 3.4:1 — fails for body, passes for large/UI).Test with a contrast checker (WebAIM, Stark, Chrome DevTools). It's faster than guessing.
A workable system architecture:
One hue. This is the color users will associate with your product. Choose with awareness of category conventions (banking is often blue; food is often warm; tech is often blue or green).
9–11 stops from white to near-black. Tinting the neutrals slightly toward the brand primary (e.g., 4% saturation of the primary hue) makes the whole UI feel cohesive without anyone consciously noticing.
neutral-50 background (lightest)
neutral-100 subtle background, hover
neutral-200 borders, dividers
neutral-300 strong borders
neutral-400 placeholder, icons
neutral-500 muted text
neutral-600 secondary text
neutral-700 primary body text
neutral-800 strong text, headings
neutral-900 highest contrast
Three to five hues for status:
For each, define multiple stops: a tinted background (green-50), a darker text color (green-700), a focus or border color (green-500).
A palette tuned for light mode often fails in dark mode — saturation and contrast perception inverts. Build dark-mode tokens deliberately, not by simple inversion.
Every text-on-background pair you ship must clear 4.5:1 (body) or 3:1 (large/UI). Test with a contrast checker; fix what fails.
<style>
.badge { display: inline-flex; align-items: center; gap: 4px;
padding: 2px 8px; border-radius: 9999px;
font-size: 12px; font-weight: 500; }
.badge--success { background: hsl(142 70% 95%); color: hsl(142 70% 22%); }
.badge--warning { background: hsl(38 95% 95%); color: hsl(38 90% 25%); }
.badge--error { background: hsl(0 80% 95%); color: hsl(0 75% 32%); }
.badge--neutral { background: hsl(0 0% 96%); color: hsl(0 0% 30%); }
</style>
<span class="badge badge--success"><CheckIcon aria-hidden /> Paid</span>
<span class="badge badge--warning"><ClockIcon aria-hidden /> Pending</span>
<span class="badge badge--error"><AlertIcon aria-hidden /> Overdue</span>
<span class="badge badge--neutral"><PencilIcon aria-hidden /> Draft</span>
Each badge uses color, icon, and text. Color carries category at a glance; icon and text carry it for color-blind users and for any out-of-context display.
<button class="btn-primary">Save changes</button>
<button class="btn-secondary">Cancel</button>
.btn-primary {
background: hsl(220 90% 50%); /* full-saturation brand */
color: white;
/* ...padding, radius... */
}
.btn-secondary {
background: white;
color: hsl(0 0% 27%);
border: 1px solid hsl(0 0% 85%); /* neutral, no color emphasis */
}
The primary uses full saturation and the brand hue; the secondary uses neutrals only. The eye picks the primary instantly.
:root {
--chart-1: hsl(220 70% 55%);
--chart-2: hsl(160 60% 45%);
--chart-3: hsl(40 90% 55%);
--chart-4: hsl(310 60% 55%);
--chart-5: hsl(10 70% 55%);
}
Five hues at similar lightness and saturation, distributed around the wheel. Each is distinct from the others and survives most color-blindness simulations. For more series, add patterns (dashed lines, dotted, hatched fills) rather than adding more hues.
* or "required" text. Color-blind users miss it.#999 on white). Fails AA contrast; fatigues all readers.hierarchy-color-and-tone — color as a hierarchy axis.highlighting — color is the strongest highlighting tool.signal-to-noise-ratio — color discipline is at the core of SNR design.accessibility-perceivable (process) — color decisions are accessibility decisions.expectation-effect (interaction) — color signals shape user expectations.uniform-connectedness — color is one of the strongest grouping signals.interference-effects — mismatched color/meaning (red "go" button) creates Stroop interference.color-semantic-systems — building status/category color systems that scale and stay consistent.color-accessibility-and-mode — accessibility-aware color, dark mode, and high-contrast support.Color is the loudest single dimension a designer commands. The discipline is in the restraint: a small palette, used consistently, with each color earning its place. Designs that respect this restraint feel polished; designs that don't feel noisy. Spend color where it earns the volume.