agentleFS
jholhewresjholhewres/devclaw-skills/skills/color-contrast/SKILL.md

color-contrast

Skill4 starsChanged 9 months agoMITView on GitHub

Calculate WCAG color contrast ratios

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test both light and dark mode combinations

    line 39

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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 Contrast Checker

Calculate WCAG contrast ratios using bash + Python (or inline math).

Quick Check (Python one-liner)

python3 -c "
def lum(r,g,b):
    cs = [c/255.0 for c in (r,g,b)]
    cs = [(c/12.92 if c<=0.03928 else ((c+0.055)/1.055)**2.4) for c in cs]
    return 0.2126*cs[0]+0.7152*cs[1]+0.0722*cs[2]
def contrast(fg,bg):
    l1,l2 = max(lum(*fg),lum(*bg)),min(lum(*fg),lum(*bg))
    return (l1+0.05)/(l2+0.05)
fg = (FG_R, FG_G, FG_B)
bg = (BG_R, BG_G, BG_B)
r = contrast(fg,bg)
print(f'Ratio: {r:.2f}:1')
print(f'AA Normal (4.5:1): {\"PASS\" if r>=4.5 else \"FAIL\"}')
print(f'AA Large (3:1): {\"PASS\" if r>=3.0 else \"FAIL\"}')
print(f'AAA Normal (7:1): {\"PASS\" if r>=7.0 else \"FAIL\"}')
"

WCAG Requirements

LevelNormal TextLarge Text
AA4.5:13:1
AAA7:14.5:1

Large text = 18pt+ regular or 14pt+ bold.

Tips

  • Convert hex to RGB: #FF6600 = (255, 102, 0)
  • Test both light and dark mode combinations
  • Common fail: light gray text on white background

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.

Reviews can't be read right now.

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.