color-theory
Check and build accessible color palettes against WCAG 2.1 contrast standards. Use whenever the user is choosing text/background colors, theme tokens, chart series colors, or button/link states and needs to know whether a pair is readable — e.g. "is #777 on white accessible?", "does this palette pass AA?", "pick a text color that meets AAA on this background", "fix the contrast on these buttons", "WCAG contrast ratio", "is this color-blind safe enough to read". Trigger even when the user only says "are these colors okay to read" or names two hex codes and asks if they work together. Do NOT use for purely aesthetic choices with no readability/contrast concern (brand-mood palettes, gradient vibes), for image color extraction, or for print/CMYK color matching — this skill is about on-screen legibility math.
- License 许可
- GPL-3.0
- 所属仓库
- inputloop/garden
- 最近更新
- 2026-10-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- color-theory
- metadata
- { "source": "polygram-synth", "gate_score": 1, "reviewed_by": "skillbuilder-gate+sre-gate" }
- description
- Check and build accessible color palettes against WCAG 2.1 contrast standards. Use whenever the user is choosing text/background colors, theme tokens, chart series colors, or button/link states and needs to know whether a pair is readable — e.g. "is #777 on white accessible?", "does this palette pass AA?", "pick a text color that meets AAA on this background", "fix the contrast on these buttons", "WCAG contrast ratio", "is this color-blind safe enough to read". Trigger even when the user only says "are these colors okay to read" or names two hex codes and asks if they work together. Do NOT use for purely aesthetic choices with no readability/contrast concern (brand-mood palettes, gradient vibes), for image color extraction, or for print/CMYK color matching — this skill is about on-screen legibility math.
02 资源文件 14
- 其他.arc/2026-09/signature-2026-09-23_pre-header-pass.asc659 B
- 其他.arc/2026-09/signature-2026-09-24_162126Z_pre-manifest.asc659 B
- 其他.arc/2026-09/signature-2026-09-27_203833Z_pre-manifest.asc659 B
- 其他.arc/2026-09/SKILL-2026-09-23_pre-header-pass.md.asc659 B
- 参考文档.arc/2026-09/SKILL-2026-09-27_pre-hardening.md3.8 KB
- 其他.arc/2026-09/skill-manifest-2026-09-23_pre-header-pass234 B
- 其他.arc/2026-09/skill-manifest-2026-09-24_162126Z_pre-manifest519 B
- 其他.arc/2026-09/skill-manifest-2026-09-27_203833Z_pre-manifest153 B
- 其他.arc/2026-10/signature-2026-10-10_104824Z_pre-manifest.asc659 B
- 其他.arc/2026-10/skill-manifest-2026-10-10_104824Z_pre-manifest230 B
- 其他.signature.asc659 B
- 其他.skill-manifest230 B
- 脚本tests.sh7.7 KB
- 脚本tool.py7.1 KB
03 SKILL.md 正文
Color Theory — accessible-palette checking
Choosing colors is easy; choosing colors people can actually read is a math problem. WCAG 2.1 defines a contrast ratio between two colors (1:1 identical → 21:1 black-on-white) and minimum thresholds for legibility. This skill makes that math concrete so a palette decision is grounded, not guessed.
When to use
Reach for this whenever readability is on the line: text on a background, theme tokens, link/button/disabled states, chart series against a canvas, or any "do these two colors work together?" question. If the user only cares about mood or branding and nobody has to read anything, this skill does not apply.
The thresholds (WCAG 2.1)
| Level | Normal text | Large text (>=18pt, or >=14pt bold) |
|---|---|---|
| AA | >= 4.5 : 1 | >= 3.0 : 1 |
| AAA | >= 7.0 : 1 | >= 4.5 : 1 |
AA is the common legal/accessibility floor; aim for AAA on body text when you can. UI components and graphical objects have their own 3.0:1 floor.
How to apply
-
Identify the foreground/background pairs that actually matter (body text on page, label on button, each chart line on its canvas). Don't audit colors no one reads.
-
Run the bundled tool to get the ratio and pass/fail per level. Use it rather than eyeballing — perceived brightness is a poor guide and the sRGB luminance formula is not something to do in your head.
# one pair python3 tool.py contrast "#777777" "#ffffff" # find a passing text color on a fixed background python3 tool.py suggest "#1e2a78" --level AA # audit many pairs from a file (one "FG BG" per line) or stdin; it says how many # pairs it read, and an audit that read none is NOT CHECKED (exit 2), never a pass # (that rule is Bryant Frankford's, from his color-theory 1.1, 2026-10-05) python3 tool.py audit pairs.txt -
If a pair fails, prefer adjusting lightness first (darken/lighten one side) before changing hue — it usually fixes contrast while preserving the intended color identity. Re-run the tool to confirm.
-
Report the ratio and the levels it clears, not just "looks fine." A number is reviewable; a vibe is not.
Notes and limits
- Contrast ratio is symmetric (fg/bg order doesn't change the number); the tool normalizes either way.
- WCAG contrast is not a full color-blindness check. Meeting AA helps, but for critical distinctions (e.g. red/green status) also avoid encoding meaning by hue alone.
- This is on-screen sRGB math; it says nothing about print/CMYK.
How this skill can fail (falsifiers)
- Wrong math. fails if
python3 tool.py contrast "#ffffff" "#000000"prints anything but 21.00:1, or#777777on#ffffffpasses AA normal text (it is 4.48:1); check: run both. - Order matters when it should not. fails if swapping foreground and background changes the ratio; check: run
contrastboth ways. - A suggestion that fails. fails if
suggest BG --level AAreturns a color below 4.5:1 on BG; check: feed the suggestion back intocontrast.
<!-- footer: minted by bin/ft1mt from conventions/house.env and conventions/FOOTERS.org; edit those, not this --> Version 1.1.0: edition revised from 1.0.1 on 2026-10-10; spine: 2026-07-05.
Copyright 2026 Corwin Brust corwin@bru.st and Contributors; CC-BY-SA4: https://creativecommons.org/licenses/by-sa/4.0/ (scripts GPL-3.0-or-later); Mentat (for Corwin; claude-opus-5-5) <!-- /footer -->
04 同仓库更多 Skills
alpha
暂无简介
gamma
暂无简介
quiet
A fixture skill that declares no preferences, so skill.quiet.* has no reader.
demo
A fixture skill for tests/prefs-declared-spec.rb; it declares two preferences inline.
concise
Synthesized by polygram from memory tag 'concise'. explicitly flagged. Review and tighten this description before relying on it for triggering.
writing-forms
Which writing form a dated deliverable takes in the shop, and the five techniques every form shares. Use whenever someone is about to write a dated deliverable — "which form is this?", "write it up", "land a note / card / model / lens", "what shape does a … take", "is there a form for this", or when a new PREFIX-date-slug filename is about to be minted. Carries the rule that a deliverable picks ONE form and says so in its filename, points at the register c/wf (columns d/c/wf) as the source of truth, names the most-used forms, the five cross-cutting techniques (two piles · cite at the act · a falsifier on every concern · the pair rule · his words), how a new form is born, and the fence on notes other sessions wrote. Not rolls (report kinds and their guards), not reformat-prompt (the REFORMAT pair), not run-card (the RUNCARD), not skill-creator (skills). Owns the FORM, not the content.