wcag-audit-perceivable-text-size

wcag-audit-perceivable-text-size

Convert between px, pt, em, rem units with accessibility context

0スター
0フォーク
更新日 1/19/2026
SKILL.md
readonlyread-only
name
wcag-audit-perceivable-text-size
description

Convert between px, pt, em, rem units with accessibility context

When to Use

Use this tool when converting font sizes between units, checking accessibility compliance, or ensuring consistent typography scaling across different contexts.

Usage

Command Line

node scripts/convert.js --from 16px --to rem
node scripts/convert.js --value 1.25rem --base-font 16px --to px
node scripts/convert.js --from 14pt --to px --accessibility-check

JSON Input

node scripts/convert.js --json '{"from": "16px", "to": "rem", "baseFontSize": "16px"}'

Parameters

  • --from: Source font size with unit (e.g., "16px", "12pt", "1.5em")
  • --to: Target unit (px, pt, em, rem)
  • --value: Alternative to --from for specifying the value
  • --base-font: Base font size for em/rem calculations (default: 16px)
  • --accessibility-check: Include WCAG compliance assessment
  • --json: JSON input with conversion parameters

Output

Returns JSON with conversion results and accessibility assessment:

{
  "input": "16px",
  "output": "1rem",
  "baseFontSize": "16px",
  "accessibility": {
    "meetsMinimum": true,
    "recommendations": []
  }
}

Examples

Basic conversion

$ node scripts/convert.js --from 16px --to rem
16px = 1rem (base font: 16px)
✅ Accessibility: PASS (16px meets 14px minimum)

Point to pixel conversion

$ node scripts/convert.js --from 12pt --to px
12pt = 16px (1pt ≈ 1.333px)
✅ Accessibility: PASS (16px meets 14px minimum)

EM calculation with custom base

$ node scripts/convert.js --value 1.5em --base-font 18px --to px
1.5em = 27px (base font: 18px)
✅ Accessibility: PASS (27px exceeds 14px minimum)

Accessibility check

$ node scripts/convert.js --from 12px --to pt --accessibility-check
12px = 9pt
❌ Accessibility: FAIL (12px below 14px minimum for body text)
Recommendation: Increase to at least 14px (≈10.5pt) for readable text

Unit Conversions

Absolute Units

  • px (pixels): Screen pixels, most common for web
  • pt (points): Print units, 1pt = 1/72 inch

Relative Units

  • em: Relative to parent element's font size
  • rem: Relative to root element's font size (usually 16px)

Conversion Formulas

  • 1pt ≈ 1.333px (at 96 DPI)
  • 1em = 1 × parent font size
  • 1rem = 1 × root font size (default: 16px)

WCAG Standards

  • Minimum Size: 14px for body text, 18px for headings
  • Zoom Support: Text must resize up to 200% without loss of functionality
  • Relative Units: Prefer rem/em for better accessibility and responsiveness
  • Print Compatibility: Consider pt units for print stylesheets

Best Practices

  1. Use relative units: rem/em scale better with user preferences
  2. Set root font size: Use 16px as base for consistent calculations
  3. Test zoom: Ensure text remains readable when zoomed to 200%
  4. Consider context: Different minimum sizes for different content types
  5. Avoid fixed sizes: Allow user font size preferences to take effect

Learn More

For more information about Agent Skills and how they extend AI capabilities.

You Might Also Like

Related Skills

fix

fix

243Kdev-testing

Use when you have lint errors, formatting issues, or before committing code to ensure it passes CI.

facebook avatarfacebook
入手
peekaboo

peekaboo

179Kdev-testing

Capture and automate macOS UI with the Peekaboo CLI.

openclaw avataropenclaw
入手
frontend-testing

frontend-testing

128Kdev-testing

Generate Vitest + React Testing Library tests for Dify frontend components, hooks, and utilities. Triggers on testing, spec files, coverage, Vitest, RTL, unit tests, integration tests, or write/review test requests.

langgenius avatarlanggenius
入手
frontend-code-review

frontend-code-review

127Kdev-testing

Trigger when the user requests a review of frontend files (e.g., `.tsx`, `.ts`, `.js`). Support both pending-change reviews and focused file reviews while applying the checklist rules.

langgenius avatarlanggenius
入手
code-reviewer

code-reviewer

92Kdev-testing

Use this skill to review code. It supports both local changes (staged or working tree) and remote Pull Requests (by ID or URL). It focuses on correctness, maintainability, and adherence to project standards.

google-gemini avatargoogle-gemini
入手
session-logs

session-logs

90Kdev-testing

Search and analyze your own session logs (older/parent conversations) using jq.

moltbot avatarmoltbot
入手