WCAG contrast ratios and font sizes implementation

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Contrast and Font Size Implementation (WCAG)

WCAG 2.1 establishes minimum contrast and font size requirements to ensure readability for people with visual impairments.

WCAG Contrast Requirements

Level Normal Text Large Text (18pt / 14pt bold)
AA (minimum) 4.5:1 3:1
AAA (enhanced) 7:1 4.5:1

Decorative elements, logos, and inactive UI components are exempt.

Contrast Checking

# CLI tool
npx wcag-contrast "#333333" "#ffffff"   # 12.63:1 — excellent

# Online: WebAIM Contrast Checker
# https://webaim.org/resources/contrastchecker/

# In Figma: A11y - Color Contrast Checker plugin
# In Chrome DevTools: Elements tab → CSS → color circle → shows ratio

CSS Variables for Accessible Color Scheme

:root {
    /* Text colors */
    --color-text-primary:   #1a1a1a;   /* on white: 17.1:1 ✓ AAA */
    --color-text-secondary: #595959;   /* on white: 7.0:1  ✓ AA */
    --color-text-muted:     #767676;   /* on white: 4.54:1 ✓ AA minimum */

    /* Accent color — check on all backgrounds */
    --color-accent:    #005EA2;        /* on white: 5.9:1  ✓ AA */
    --color-accent-hover: #1a4480;     /* on white: 8.6:1  ✓ AAA */

    /* Background colors */
    --color-bg-primary:   #ffffff;
    --color-bg-secondary: #f5f5f5;
    --color-bg-dark:      #1a1a1a;
}

/* White text on dark backgrounds */
.dark-bg {
    background: var(--color-bg-dark);
    color: #ffffff;  /* 17.1:1 ✓ */
}

Font Sizes

:root {
    /* Base size — not less than 16px for body text */
    font-size: 16px;

    /* Scalable sizes via rem */
    --text-xs:   0.75rem;   /* 12px */
    --text-sm:   0.875rem;  /* 14px */
    --text-base: 1rem;      /* 16px — minimum for body text */
    --text-lg:   1.125rem;  /* 18px */
    --text-xl:   1.25rem;   /* 20px */
    --text-2xl:  1.5rem;    /* 24px */
}

/* Never block user scaling */
/* Bad: */
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
/* Good: */
<meta name="viewport" content="width=device-width, initial-scale=1">

/* Line height — minimum 1.5 for body text */
body {
    line-height: 1.5;
    font-size: var(--text-base);
}

/* For paragraphs — 1.6-1.8 */
p {
    line-height: 1.6;
}

Automated Accessibility Check in CI

// .pa11yrc.json — Pa11y config
{
    "standard": "WCAG2AA",
    "runners": ["axe", "htmlcs"],
    "ignore": [
        "color-contrast"  // separate check via contrast-finder
    ]
}

// GitHub Actions
- name: Check accessibility
  run: |
    npx pa11y-ci --sitemap https://staging.example.com/sitemap.xml \
                 --threshold 0

Timeline

Contrast and font size audit on existing project — 1 day. Fixes in design system (CSS variables) — 1–2 days.