mcpField
A
accessible-contrast

accessible-contrast

github.com/basiclinesDesign & UI1652 installsUpdated 32w ago
Repository

About accessible-contrast

accessible-contrast is a color-generation skill for designers and developers building readable interfaces. It uses an 11-step ramp with predictable index pairs for WCAG contrast levels.

Key features

  1. 0111-step color ramps
  2. 02Predictable symmetrical pairings
  3. 03WCAG AA and AAA contrast guidance
  4. 04CSS output for named colors

Use cases

  1. 01Generate accessible text and background colors
  2. 02Create consistent ramps for brand colors
  3. 03Choose contrast pairs for buttons and large text

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/basiclines/rampa-studio --skill accessible-contrast

After installing, type/accessible-contrastin Claude Code to confirm it loaded.

Details

From the project README

Accessible Contrast Pairs

Generate color ramps specifically designed for accessible text/background combinations. Uses an 11-step scale for predictable WCAG-compliant pairing.

When to Use

  • "Create accessible color combinations"
  • "I need WCAG compliant colors"
  • "Generate high contrast pairs"
  • "Make sure my text is readable"

Installation

npx @basiclines/rampa

The 11-Step Strategy

Why 11 steps? It creates predictable pairing math:

PairIndicesContrast Level
Maximum0 + 10Highest (near white + near black)
AAA Normal1 + 9, 2 + 87:1+ ratio
AA Normal3 + 74.5:1+ ratio
AA Large4 + 63:1+ ratio

Recipe

rampa -C "<brand-color>" -L 98:5 --size=11 -O css --name=color
  • -L 98:5 ensures full range from near-white to near-black
  • --size=11 creates indices 0-10 for easy pairing
  • Pairs are symmetrical: 0+10, 1+9, 2+8, etc.

Complete Example

For brand color #3b82f6:

rampa -C "#3b82f6" -L 98:5 --size=11 -O css --name=blue

Output:

:root {
  --blue-0: #f8fafc;   /* Near white */
  --blue-1: #f1f5f9;
  --blue-2: #e2e8f0;
  --blue-3: #cbd5e1;
  --blue-4: #94a3b8;
  --blue-5: #64748b;   /* Middle gray */
  --blue-6: #475569;
  --blue-7: #334155;
  --blue-8: #1e293b;
  --blue-9: #0f172a;
  --blue-10: #020617;  /* Near black */
}

Contrast Pairing Guide

For Normal Text (4.5:1 minimum - WCAG AA)
/* Light backgrounds with dark text */
.light-subtle {
  background: var(--blue-0);
  color: var(--blue-7);  /* 0+7 = AA */
}

.light-default {
  background: var(--blue-1);
  color: var(--blue-8);  /* 1+8 = AA */
}

.light-strong {
  background: var(--blue-2);
  color: var(--blue-9);  /* 2+9 = AAA */
}

/* Dark backgrounds with light text */
.dark-subtle {
  background: var(--blue-10);
  color: var(--blue-3);  /* 10+3 = AA */
}

.dark-default {
  background: var(--blue-9);
  color: var(--blue-2);  /* 9+2 = AA */
}

.dark-strong {
  background: var(--blue-8);
  color: var(--blue-1);  /* 8+1 = AAA */
}
For Large Text (3:1 minimum - WCAG AA)
.large-text {
  background: var(--blue-3);
  color: var(--blue-7);  /* 3+7 = AA Large */
}
Maximum Contrast
.max-contrast {
  background: var(--blue-0);
  color: var(--blue-10);  /* 0+10 = Maximum */
}

Quick Reference Table

BackgroundText for AAText for AAA
07, 8, 9, 108, 9, 10
17, 8, 9, 108, 9, 10
28, 9, 109, 10
38, 9, 109, 10
70, 1, 2, 30, 1, 2
80, 1, 2, 30, 1, 2
90, 1, 20, 1
100, 1, 20, 1

Multiple Colors

Generate accessible ramps for multiple brand colors:

rampa -C "#3b82f6" -L 98:5 --size=11 -O css --name=blue
rampa -C "#22c55e" -L 98:5 --size=11 -O css --name=green
rampa -C "#ef4444" -L 98:5 --size=11 -O css --name=red

All ramps use the same index pairing logic.

Tips

  1. The -L 98:5 range is crucial - it ensures full contrast range
  2. Middle values (4, 5, 6) work for disabled/muted states
  3. Always test actual rendered contrast - tools like Stark, axe can verify
  4. The index math (0+10, 1+9, 2+8) makes theming predictable
  5. For buttons: use index 5-6 as background, 0-1 as text

Comments

Markdown supported