रंग विपरीतता चेकर
अभिगम्यता के लिए WCAG 2.1 कंट्रास्ट अनुपात का परीक्षण करें।
कैसे उपयोग करें
- अग्रभूमि (टेक्स्ट) रंग और पृष्ठभूमि रंग चुनें।
- कंट्रास्ट अनुपात तुरंत अपडेट होता है।
- सामान्य और बड़े टेक्स्ट के लिए WCAG रेटिंग (AA/AAA) जाँचें।
- रंग अदला-बदली करने के लिए Swap पर क्लिक करें।
अक्सर पूछे जाने वाले प्रश्न
WCAG क्या है?
WCAG (Web Content Accessibility Guidelines) वेब सामग्री को सुलभ बनाने के लिए अंतर्राष्ट्रीय मानक हैं। स्तर AA सबसे अधिक आवश्यक मानक है। स्तर AAA उच्चतम है।
«बड़े टेक्स्ट» के रूप में क्या गिना जाता है?
बड़ा टेक्स्ट कम से कम 18 pt (24 px) या 14 pt (18.66 px) बोल्ड के रूप में परिभाषित है। इसकी कंट्रास्ट आवश्यकता कम है क्योंकि इसे पढ़ना आसान है।
कौन सा कंट्रास्ट अनुपात लक्षित करें?
मुख्य टेक्स्ट के लिए, कम से कम 4.5:1 (AA) का लक्ष्य रखें। सर्वोत्तम अभिगम्यता के लिए, 7:1 (AAA) का लक्ष्य रखें। शीर्षक और बड़े टेक्स्ट को कम से कम 3:1 की आवश्यकता होती है।
WCAG वास्तव में क्या measure करता है
Web accessibility में contrast का मतलब colors कितने अलग दिखते हैं नहीं है, यह दो colors के बीच relative luminance का precise ratio है। Luminance एक perceptual approximation है कि एक typical sighted observer को color कितना bright appear होता है। Ratio 1:1 (identical luminance वाले दो colors, एक-दूसरे के against invisible) से 21:1 (pure black #000000 against pure white #ffffff) तक चलता है। तीन normative WCAG success criteria इस ratio का use करते हैं:
- 1.4.3 Contrast (Minimum), Level AA: normal text के लिए कम से कम 4.5:1, large text के लिए 3:1।
- 1.4.6 Contrast (Enhanced), Level AAA: कम से कम 7:1 normal, 4.5:1 large।
- 1.4.11 Non-text Contrast, Level AA (WCAG 2.1 में added), UI components और adjacent colors के against meaningful graphical objects के लिए कम से कम 3:1।
4.5:1 floor arbitrary नहीं है। WCAG का अपना derivation normal vision के लिए 3:1 ANSI baseline use करता है जिसे 20/40 acuity वाले users के लिए 1.5 से multiply किया जाता है (वह threshold जो legal low vision define करने के लिए अक्सर use होती है)। 4.5 = 3 × 1.5। 7:1 AAA threshold same logic को roughly 20/80 acuity तक extend करती है। Logos, brand names, और incidental या decorative text exempt हैं, लेकिन बाकी सब rule के अंतर्गत आता है।
Formula
WCAG technique G18 में contrast formula के तीन steps हैं। Inputs 8-bit sRGB channel values (0-255) हैं, हर एक पहले 0-1 range में convert होता है:
- sRGB linearise करें (gamma curve undo करें)। हर channel V के लिए: यदि V ≤ 0.04045, तो V_linear = V ÷ 12.92; otherwise V_linear = ((V + 0.055) ÷ 1.055)^2.4। (Older WCAG documents 0.03928 use करते थे; W3C ने formal sRGB spec से match करने के लिए errata-update करके 0.04045 कर दिया, numerical difference negligible है।)
- Relative luminance compute करें: L = 0.2126·R + 0.7152·G + 0.0722·B (linearised)। Weights CIE 1931 standard observer's photopic luminosity function से आते हैं, human eye green (~71%), फिर red (~21%), फिर blue (~7%) के लिए सबसे ज़्यादा sensitive है। इसीलिए white पर pure blue text contrast fail कर सकता है भले ही colors बहुत different दिखते हों।
- Ratio लें: (L1 + 0.05) ÷ (L2 + 0.05), जहां L1 lighter color है और L2 darker। 0.05 offset typical display पर ambient flare model करता है, और ratio को near-black color होने पर blow up होने से रोकता है।
Black on white का worked example: white का L = 1.0 है, black का L = 0 है, इसलिए ratio है (1 + 0.05) ÷ (0 + 0.05) = 21। यह sRGB में maximum possible contrast है।
«Large text» क्या माना जाता है?
WCAG large-scale text को कम से कम 18 point (regular weight) या 14 point bold के रूप में define करता है। W3C-stated 1pt = 1.333px पर CSS pixels में converted:
- 18pt = 24px सामान्य
- 14pt bold = 18.66px मोटा
अधिकांश browsers default body text को 16px / 12pt पर set करते हैं, large नहीं। एक common mistake किसी भी heading को large treat करना है; 18px regular पर styled <h3> अभी भी 4.5:1 normal-text rule के अंतर्गत आता है।
प्रसिद्ध edge case: सफ़ेद पर #767676
Minimalism की चाह रखने वाले designers अक्सर body text के लिए mid-greys choose करते हैं। दो values जो eye को identical लगती हैं WCAG line के opposite sides पर होती हैं:
| Foreground | Background | Ratio | AA सामान्य |
|---|---|---|---|
| #000000 | #ffffff | 21.00 | पास (अधिकतम) |
| #595959 | #ffffff | ~7.0 | पास + AAA |
| #767676 | #ffffff | 4.54 | पास (बस) |
| #777777 | #ffffff | 4.48 | Fail |
| #959595 | #ffffff | 3.00 | विफल (केवल large text) |
| #ffff00 | #ffffff | 1.07 | Fail |
एक-character hex shift, #767676 और #777777 के बीच का difference: same-looking grey को passing से failing में flip करता है, क्योंकि WCAG explicitly ratios को round up करने की मनाही करता है। WebAIM specifically #777777 को commonly-used ऐसे grey के रूप में call out करता है जो AA meet नहीं करता। यह single gotcha real-world site scans में automated-audit failures की measurable share drive करती है।
Formula कहां कम पड़ती है
Relative-luminance formula fast और deterministic है, लेकिन इसमें well-documented perceptual flaws हैं:
- Symmetry। WCAG 2 same ratio return करता है चाहे आप dark background पर light text रखें या light पर dark। Empirical reading studies दिखाते हैं कि light-on-dark को dark-on-light जितना ही readable feel करने के लिए more contrast चाहिए, partly pupil dilation और bright glyphs against dark fields पर halation की वजह से। Dark-mode UIs जो WCAG 2 AA pass करते हैं फिर भी washed out feel हो सकते हैं।
- Spatial blindness। Formula font weight, stroke thickness, और Large Text threshold से परे font size को ignore करता है। 18px hairline font और 900-weight 18px font identically treat होते हैं।
- Dark-mode over-pass। APCA documentation के अनुसार, formula dark colors के लिए systematically contrast overstate करता है। दो dark greys जो mathematically WCAG 2 pass करते हैं real monitor पर visually indistinguishable हो सकते हैं।
APCA (Accessible Perceptual Contrast Algorithm) WCAG 3 के लिए prototyped candidate replacement है। यह roughly −108 से +106 तक single signed Lc value return करता है, polarity-aware है, और font-weight / size lookup include करता है। APCA currently एक beta non-commercial reference है, legal conformance target नहीं (production sites को still WCAG 2.1 / 2.2 AA target करना चाहिए) लेकिन यह अधिक accurate readability check है, especially dark mode के लिए। Chrome DevTools में अपने color picker में APCA preview built-in है।
यह legally क्यों Important है
WCAG 2.2 5 October 2023 को W3C Recommendation बना, लेकिन contrast criteria 2.1 से unchanged carry forward होते हैं। Color contrast digital accessibility lawsuits में सबसे ज़्यादा cited issues में से एक है, और कई jurisdictions इसे effectively mandatory बनाते हैं:
- United States, Section 508 (2017 में refreshed) WCAG 2.0 AA के साथ harmonised है, इसलिए federal procurement के लिए 4.5:1 binding है। ADA Title III court rulings ने repeatedly WCAG AA को public-facing commercial sites के लिए de-facto standard के रूप में cite किया है। DOJ ने April 2024 में एक Title II rule adopt किया जिसमें state और local government web content को WCAG 2.1 AA meet करने की requirement है, इस decade के बाद phased deadlines के साथ।
- European Union, EN 301 549 WCAG 2.1 AA embed करता है। European Accessibility Act (Directive 2019/882) compliance deadline 28 June 2025 था, websites, mobile apps, e-commerce, banking, e-books और अधिक को cover करते हुए। Microenterprises services के लिए exempt हैं। Member-state penalties vary होते हैं।
- United Kingdom, Equality Act 2010 का «reasonable adjustments» duty private और public sector पर apply होता है। Public-sector bodies 2018 accessibility regulations से bound हैं जो EN 301 549 / WCAG 2.1 AA incorporate करते हैं।
- Canada, AODA (Ontario) और federal Accessible Canada Act WCAG 2.0 AA require करते हैं, AODA की phased deadlines long past हो चुकी हैं।
Color Contrast बनाम Color Blindness
एक common point of confusion: WCAG ratio luminance-based है और most color-blind users के लिए useful रहता है, luminance से derived 4.5:1 ratio एक strong perceptual signal correspond करता है भले ही hue cues lost हों। इसीलिए contrast criteria एक separate criterion के साथ-साथ sit करते हैं, 1.4.1 Use of Color, जो information convey करने के लिए अकेले color पर rely करने की मनाही करता है। Contrast यह नहीं बताता कि deuteranope के लिए red-vs-green chart legible है या नहीं, केवल यह कि हर color individually chart background से contrast करता है या नहीं। Charts और stateful UI को color के ऊपर patterns, labels या shapes layer करने की ज़रूरत है।
Practical Checklist
- White पर body text: AAA के लिए
#595959या darker रहें;#767676सबसे lightest grey है जो AA Normal pass करता है। - Brand blues: कई 3-4.5 range में आते हैं।
#1976d2एक typical Material blue है roughly 4.59:1 पर, यह white पर AA Normal barely pass करता है।#42a5f5roughly 2.6:1 पर fail करता है। - Form borders: white पर
1px solid #cccborder roughly 2.13:1 है, यह 1.4.11 fail करती है।#767676या darker use करें। - Focus indicators background के against 3:1 reach करने चाहिए। Default browser outline अक्सर reset CSS से override होती है बिना replacement के जो threshold meet करे।
- Placeholder text technically incidental है लेकिन users इसे read करते हैं, इसे treat करें जैसे 4.5:1 apply हो।
- Dark mode के लिए eye पर trust न करें। WCAG 2 ratios systematically dark backgrounds को over-pass करते हैं। Chrome DevTools में APCA के साथ cross-check करें।
अधिक Questions
Pure yellow white पर fail क्यों करता है जब यह bright दिखता है?
White पर yellow (#ffff00) 1.07:1 है, almost कोई contrast नहीं। Luminance formula green को 71% और red को 21% weight करता है, इसलिए yellow (R+G) की luminance white के बहुत close है। Black पर yellow, इसके विपरीत, 19.56:1 है, जो known सबसे legible combinations में से एक है, इसीलिए यह road signs और hard-hat warnings के लिए use होता है।
क्या मुझे हमेशा AAA target करना चाहिए?
नहीं। WCAG खुद कहता है: «It is not recommended that Level AAA conformance be required as a general policy for entire sites because it is not possible to satisfy all Level AAA Success Criteria for some content.» AA लगभग हर जगह legal target है; AAA high-stakes informational reading के लिए है (long-form content, general public के लिए intended government documents, accessibility-first publications)।
क्या automated tools हर contrast failure catch कर सकते हैं?
नहीं। axe-core, Lighthouse और similar audits text-on-flat-color failures reliably flag करते हैं, लेकिन वे background images, CSS gradients, pseudo-element backgrounds, या CSS border colors पर overlaid text test नहीं कर सकते, उन्हें «incomplete» flag किया जाता है और manual review चाहिए। इस जैसा live picker image से dominant background color sample करने और shipping से पहले केवल text/background pair check करने के लिए independently useful है।
क्या यह tool transparency / alpha support करता है?
यह page opaque hex pairs check करता है। यदि आपके text या background में alpha है, तो actual contrast इस पर depend करता है कि उसके पीछे क्या है, आपको पहले composited foreground compute करना होगा और resulting opaque colour check करनी होगी।
क्या कुछ server को भेजा जाता है?
नहीं। Luminance formula और ratio आपके browser में compute होते हैं; colors आपके device से नहीं निकलते। Page एक बार load होने के बाद offline काम करता है।