agentleFS
tkollehtkolleh/skills/color-accessibility/SKILL.md

color-accessibility

Skill1 starsChanged 3 months agoMITView on GitHub

Trigger on: check contrast, WCAG contrast, accessible colors, readable text color, fix low-contrast, dimmed text color, palette accessibility, pastel color, textcolor for background, make this color readable, UI theme contrast, Neovim highlight contrast. Evaluate, fix, and generate accessible fg/bg pairs with the pastel CLI and color-accessibility/main.py (WCAG AA/AAA). Use whenever the user changes colors for UI, CSS, terminal, or editor themes — do not guess contrast; measure it.

  • Installs packages

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If pastel is missing: tell the user to install (brew install pastel or cargo install pastel) and STOP.

    line 41
  2. Distinctive:

    Do not hand-pick hex. Prefer:

    line 86
  3. Distinctive:

    Prefer the textcolor / high-ratio result (often black or white, frequently AAA).

    line 93
  4. Distinctive:

    Do not scrape the nearest gray that barely clears 4.5:1 unless the user asked to preserve a gray look.

    line 94
  5. Very specific:

    Never claim WCAG pass without a Phase 2 (or post-fix) main.py result in this turn.

    line 126
  6. Distinctive:

    Gradient text: check against the lightest and darkest stops under the glyphs.

    line 143

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Color Accessibility

Prove every fg/bg pair with math before shipping colors. pastel has no contrast subcommand — use main.py in this skill directory for ratios; use pastel for manipulation (textcolor, mix, darken, lighten, format).

When to use / not use

  • Use: contrast checks, picking text on a fill, fixing failing pairs, dimmed/inactive text, theme palette audit.
  • Do not use: brand-only palette vibes with no readability ask; full diagram authoring (use diagram — it has its own contrast step).

Work phases in order. Do not skip. Do not invent ratios from memory.

Prerequisites

pastel --version    # required on PATH
python3 color-accessibility/main.py --help

If pastel is missing: tell the user to install (brew install pastel or cargo install pastel) and STOP.

Resolve main.py relative to this skill directory (or the path you loaded the skill from).

Thresholds (default)

RoleMin ratioNotes
Normal text / UI labels4.5:1 (AA)Prefer 7:1 (AAA) when easy
Large text (>=18pt / 14pt bold)3:1 (AA)Pass --large-text
Dimmed / inactiveStill >= 3:1 vs bg; strictly below active text ratioHierarchy without illegibility

Deeper WCAG notes: load references/wcag.md only if large-text, non-text UI, or AAA is disputed.

Phase 1 — Capture pairs

  1. List every fg/bg (or fill/font-color) pair the user cares about as hex or named colors.
  2. Completion: each pair has explicit fg and bg strings (no "something light gray").

Phase 2 — Measure (required)

For each pair:

python3 main.py contrast --fg '<fg>' --bg '<bg>'
# large text:
python3 main.py contrast --fg '<fg>' --bg '<bg>' --large-text
  • Exit 0 + "status":"success" -> meets default min.
  • Exit 1 + "status":"fail" -> record ratio and continue to Phase 3.
  • "status":"error" -> report reason and STOP (or fix input colors).

Optimal black/white fg for a background only:

python3 main.py textcolor --bg '<bg>'
# equivalent core: pastel textcolor '<bg>' | pastel format hex

Completion: every pair has a JSON result with ratio, level, passes_aa.

Phase 3 — Fix failures

Do not hand-pick hex. Prefer:

python3 main.py fix --fg '<fg>' --bg '<bg>' --adjust auto --min-ratio 4.5
  • auto: try pastel textcolor on bg first; else nudge fg lightness.
  • Prefer the textcolor / high-ratio result (often black or white, frequently AAA). Do not scrape the nearest gray that barely clears 4.5:1 unless the user asked to preserve a gray look.
  • --adjust fg|bg when the user freezes one side.
  • Re-run contrast on the returned pair.fg / pair.bg.

Manual pastel knobs (when fix is wrong for the aesthetic):

pastel darken 0.1 '<color>' | pastel format hex
pastel lighten 0.15 '<color>' | pastel format hex
pastel desaturate 0.2 '<color>' | pastel format hex

Completion: every required pair passes_aa (or user explicitly accepted a documented exception).

Phase 4 — Dimmed / mixed roles

Inactive text = mix fg toward bg in a perceptual space (default Lab):

python3 main.py mix-dim --fg '<active_fg>' --bg '<bg>' --fraction 0.6
# fraction = pastel --fraction = how much of the *base fg* is kept (0-1)

Then contrast the mixed color vs bg. If < 3:1, raise --fraction (keep more fg) or fix via Phase 3.

Completion: dim color hex + ratio; dim ratio < active ratio when both exist.

Phase 5 — Deliver

  1. Emit final hex pairs (and ratios) in the user's target format (CSS, Lua hl, JSON, table).
  2. Cite measured ratios next to each pair (e.g. 12.8:1 AAA).
  3. Never claim WCAG pass without a Phase 2 (or post-fix) main.py result in this turn.

Completion: user-ready snippet + no unverified pairs.

Commands cheat sheet

GoalCommand
Ratiopython3 main.py contrast --fg ... --bg ...
Best fgpython3 main.py textcolor --bg ...
Auto-fixpython3 main.py fix --fg ... --bg ... --adjust auto
Dim mixpython3 main.py mix-dim --fg ... --bg ... --fraction 0.6
Hex normalizepastel format hex '<color>'

Edge cases

  • Transparent / alpha: flatten onto the real background first; do not contrast alpha hex alone.
  • Gradient text: check against the lightest and darkest stops under the glyphs.
  • Syntax themes: active vs comment/dimmed both need Phase 2; comments still >= 3:1.
  • diagram skill: for D2 class fills, diagram/main.py check-contrast is enough inside diagram work.

Non-examples (do not load this skill alone)

  • "Draw a C4 diagram of our services" -> diagram
  • "What is the complementary hue of blue?" -> plain pastel complement is enough unless readability is in scope

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.