कुछ भी इंस्टॉल किए बिना color contrast का audit कैसे करें
WCAG contrast requirements के विरुद्ध टेक्स्ट, buttons, focus states, charts और image overlays जाँचने के लिए एक व्यावहारिक browser-first workflow.
सामग्री की तालिका
- वे contrast rules जिनकी आपको सच में ज़रूरत है
- Design file से नहीं, rendered page से शुरू करें
- पहले एक छोटी audit list बनाएँ
- DevTools में text contrast inspect करें
- Real background check करें, opacity सहित
- States को न भूलें
- Lighthouse का उपयोग करें, लेकिन judgment उसे outsource न करें
- Non-text contrast भी audit करें
- Findings को ऐसे format में record करें जिसे developers use कर सकें
- Fixes को minimum से थोड़ा stronger बनाएँ
- No-install contrast audit checklist
Color contrast audits को अक्सर एक specialist accessibility task की तरह लिया जाता है: design file खोलें, plugin install करें, screenshots export करें, report चलाएँ, brand colors पर बहस करें. यह उपयोगी हो सकता है, लेकिन ज़्यादातर teams को यहीं से शुरू नहीं करना चाहिए.
Production website के लिए, सबसे तेज़ भरोसेमंद audit आमतौर पर उसी browser में हो जाता है जो आपके पास पहले से खुला है. Modern browser DevTools computed colors inspect कर सकते हैं, contrast ratios दिखा सकते हैं, state styles उजागर कर सकते हैं, और उन मुश्किल cases को test करने में मदद कर सकते हैं जिन्हें automated reports छोड़ देती हैं.
यह guide मानती है कि आप कुछ भी install नहीं कर रहे हैं. कोई browser extensions नहीं. कोई design plugins नहीं. कोई paid audit suite नहीं. बस page, browser, और एक सरल method.
वे contrast rules जिनकी आपको सच में ज़रूरत है
अधिकांश web work के लिए, WCAG contrast कुछ thresholds तक सीमित रहता है:
- Normal text: अपने background के विरुद्ध कम-से-कम 4.5:1 contrast.
- Large text: कम-से-कम 3:1. WCAG इसे लगभग 24 CSS pixels, या bold होने पर लगभग 18.66 CSS pixels के रूप में define करता है.
- UI components and graphical objects: interface को समझने के लिए ज़रूरी meaningful boundaries, icons, states और charts के parts के लिए कम-से-कम 3:1.
- Enhanced contrast: baseline से आगे लक्ष्य कर रहे हों, तो normal text के लिए 7:1 और large text के लिए 4.5:1.
कुछ exceptions हैं, जैसे inactive controls, decorative elements और logos. इन exceptions का कम इस्तेमाल करें. “यह brand का हिस्सा है” exception नहीं है; यह design constraint है.
यह भी याद रखें कि contrast accessible color use का सिर्फ़ एक हिस्सा है. अगर red error state में पर्याप्त contrast है लेकिन कोई text, icon label या programmatic indication नहीं है, तो वह उन users के लिए फिर भी fail हो सकता है जो red को पास के colors से अलग नहीं पहचान सकते.
Design file से नहीं, rendered page से शुरू करें
Design files उपयोगी हैं, लेकिन उनमें हर real-world variable शामिल नहीं होता: CSS overrides, opacity, hover states, browser font rendering, user zoom, dark mode, inherited styles, CMS content और marketing embeds.
Page को उसी रूप में audit करें जैसा users को मिलता है.
Page को किसी current desktop browser में खोलें. Chrome, Edge, Firefox और Safari सभी में उपयोगी inspection tools हैं. Exact labels अलग हो सकते हैं, लेकिन workflow वही है:
- Text या UI element पर right-click करें.
- Inspect चुनें.
- Computed
colorऔरbackground-colorखोजें. - Contrast ratio पढ़ने के लिए browser के color swatch या accessibility panel का उपयोग करें.
- Pass, fail और uncertainty record करें.
Chromium-based browsers में, color picker अक्सर contrast ratio और text के लिए WCAG pass/fail guidance दिखाता है. Firefox DevTools भी accessibility information और color tools दिखाता है. Safari का Web Inspector computed styles और accessibility information दिखा सकता है, हालांकि workflow थोड़ा अलग है.
मुख्य बात specific browser नहीं है. मुख्य बात computed result पढ़ना है, न कि वह value जिसे कोई मानता है कि component use करता है.
पहले एक छोटी audit list बनाएँ
Random text inspect करते-करते थकने तक काम न करें. Patterns की एक छोटी inventory बनाएँ:
- Main page background पर body text.
- Muted text, captions, metadata और placeholders.
- Normal, hover, visited और focus states में links.
- Primary, secondary और destructive buttons.
- Form labels, help text, errors और success messages.
- Navigation items, breadcrumbs और tabs.
- Cards, badges, pills और tags.
- Meaning communicate करने वाले icons.
- Charts, maps, progress bars और status colors.
- Images, video, gradients या translucent overlays पर text.
Typical site पर अधिकांश failures खोजने के लिए यह पर्याप्त है. यह audit को one-off pixels के बजाय components से जोड़े रखता है.
अगर आपके audit में buttons शामिल हैं, तो contrast check को हमारी accessible web buttons checklist की basics के साथ pair करें. Button contrast problems अक्सर missing focus states, unclear labels या broken keyboard behavior के पास ही मिलते हैं.
DevTools में text contrast inspect करें
Solid background पर plain text के लिए, browser आमतौर पर आपके लिए contrast calculate कर सकता है.
Element inspect करें और color property देखें. Swatch से color picker खोलें. अगर browser background determine कर सकता है, तो वह contrast ratio दिखाएगा. कुछ tools color picker में एक line भी draw करते हैं जो दिखाती है कि color 3:1, 4.5:1 या 7:1 कहाँ pass करेगा.
जब browser failure report करे, तो उसे सही मानें जब तक आप इसके उलट साबित न कर सकें. जब वह pass report करे, तब भी judgment का उपयोग करें. Small thin type, low-quality displays, heavy anti-aliasing और busy backgrounds technically passing text को भी weak महसूस करा सकते हैं.
एक practical rule: अगर body text बस मुश्किल से 4.55:1 पर pass कर रहा है, तो celebrate न करें. उसे ज़्यादा room दें. Contrast requirements minimums हैं, ideal targets नहीं.
Typography भी मायने रखती है. Larger, clearer type system color tweaks तक पहुँचने से पहले ही strain कम कर देता है. अगर page contrast pass करने के बावजूद पढ़ने में कठिन लगता है, तो line length, size, weight और spacing को readable type पर इस practical guide जैसे broader readability lens से फिर देखें.
Real background check करें, opacity सहित
कई contrast mistakes इसलिए होती हैं क्योंकि visible background declared background नहीं होता.
Common traps में शामिल हैं:
- Semi-transparent card के अंदर text.
- ऐसे parent पर text जहाँ
opacityapplied है. rgba()याcolor-mix()का उपयोग करने वाले overlays.- Headings के पीछे gradients.
- Text area में बदलती रहने वाली background images.
- Dark mode में बदलने वाले theme variables.
अगर DevTools confidently contrast calculate नहीं कर सकता, तो rendered foreground और background colors को manually identify करें. Computed styles panel का उपयोग करें, layers को temporarily disable करें, या अगर आपका browser support करता है तो built-in color picker से visible color sample करें.
Images पर text के लिए, image के सबसे अच्छे हिस्से से sample न लें. Text के पीछे के worst plausible area को sample करें. अगर image CMS uploads, carousels या responsive crops के माध्यम से बदलती है, तो यह stable contrast system नहीं है. एक reliable overlay, text shadow, solid container या gradient treatment जोड़ें जो image चाहे जैसी हो, text को protect करे.
अच्छा image overlay system boring होता है: same overlay strength, predictable crop area, bright photos के साथ भी पर्याप्त contrast. Boring ठीक है. Users पढ़ने की कोशिश कर रहे हैं.
States को न भूलें
Static screenshots कई contrast failures छोड़ देते हैं. Browser में directly interaction states audit करें.
DevTools में pseudo-classes force करें, जैसे:
:hover:focus:focus-visible:active:visited:disabled:checked:invalid
फिर computed colors दोबारा inspect करें.
Focus indicators पर विशेष ध्यान चाहिए. WCAG 2.2 ने focus appearance को लेकर expectations मजबूत की हैं, और light gray card पर pale blue outline अभी भी common failure है. Focus indicator को adjacent colors के विरुद्ध पर्याप्त contrast और notice होने लायक पर्याप्त area चाहिए.
Disabled controls के लिए, WCAG contrast rules inactive components को exception देते हैं. इसका मतलब यह नहीं कि disabled controls default रूप से illegible होने चाहिए. अगर disabled state उपयोगी information देती है, तो उसे readable बनाएँ. अगर नहीं देती, तो सोचें कि उसे मौजूद होना भी चाहिए या नहीं.
Lighthouse का उपयोग करें, लेकिन judgment उसे outsource न करें
Lighthouse जैसे browser audits कुछ contrast failures जल्दी पकड़ सकते हैं. अगर आपका browser built-in audit देता है, तो उसे run करें, फिर results को starting point मानें.
Automated checks obvious computed contrast failures वाले text nodes खोजने में अच्छे हैं. वे इन मामलों में कमजोर होते हैं:
- Images में embedded text.
- Canvas-rendered labels.
- SVG edge cases.
- Hover-only failures.
- Focus indicator quality.
- Charts जहाँ color relationships meaning carry करते हैं.
- Authentication, menus या form steps के पीछे hidden components.
अगर report green आती है, तब भी आपको representative components inspect करने की ज़रूरत है. अगर report red आती है, तो panic से बचें और user impact के अनुसार failures triage करें. यही principle performance और accessibility reports पर भी generally लागू होता है: tool output को evidence की तरह पढ़ें, verdict की तरह नहीं. हम बिना panic किए Lighthouse report पढ़ने की हमारी guide में यही mindset use करते हैं, और यह यहाँ भी साफ़ तौर पर लागू होता है.
Non-text contrast भी audit करें
Text को सबसे ज़्यादा attention मिलती है, लेकिन WCAG interface को समझने या operate करने के लिए ज़रूरी non-text content को भी cover करता है.
कम-से-कम ये cases check करें:
- Page background के विरुद्ध input borders.
- Checkbox और radio outlines.
- Toggle states.
- Icon-only buttons.
- Error icons और warning symbols.
- Chart lines, bars और labels.
- Progress indicators.
- Selected tab या active navigation indicators.
Target आमतौर पर adjacent colors के विरुद्ध 3:1 होता है. उदाहरण के लिए, white background पर light gray input border लगभग invisible हो सकता है. पाँच pastel lines वाला chart elegant दिख सकता है और फिर भी unusable हो सकता है.
Charts के लिए, contrast अपने आप में पर्याप्त नहीं है. Labels, patterns, line styles, direct annotation या spacing का उपयोग करें ताकि information केवल color पर निर्भर न रहे. यह color-blind users, low-vision users, glare में देखने वाले लोगों और document में screenshot पढ़ने वाले किसी भी व्यक्ति की मदद करता है.
Findings को ऐसे format में record करें जिसे developers use कर सकें
Useful contrast audit यह नहीं कहता कि “कुछ grays fail हैं.” यह component, state, current values, expected threshold और suggested fix identify करता है.
Compact format अच्छा काम करता है:
| Component | State | Foreground | Background | Ratio | Target | Result | Suggested fix | |---|---:|---:|---:|---:|---:|---|---| | Card metadata | Default | #8A8F98 | #FFFFFF | 3.2:1 | 4.5:1 | Fail | --color-text-muted-strong use करें | | Primary button | Hover | #FFFFFF | #2F6FEA | 4.8:1 | 4.5:1 | Pass | रखें | | Input border | Default | #D7DCE2 | #FFFFFF | 1.4:1 | 3:1 | Fail | Border token darken करें |
अगर site में design tokens हैं, तो fixes को उनसे tie करें. अगर असली problem एक weak token है, तो twenty individual components patch न करें.
Fixes को minimum से थोड़ा stronger बनाएँ
Contrast failures को अक्सर badly fix करना आसान होता है. Teams color को तब तक nudge करती हैं जब तक checker 4.51:1 न कह दे, फिर आगे बढ़ जाती हैं. इससे font rendering, transparency, browser differences, theming, image variance या future brand edits के लिए कोई margin नहीं बचता.
Comfortable targets prefer करें:
- Body text: practical हो तो 7:1 के करीब.
- Muted text: अगर वह real content है, तो फिर भी 4.5:1 से ऊपर.
- UI borders और icons: आराम से 3:1 से ऊपर.
- Images पर text: per-image guessing के बजाय controlled overlay use करें.
Web cheap laptops, dim phones, bright sidewalks, tinted monitors और aging displays पर देखा जाता है. Minimum compliance, comfortable reading के समान नहीं है.
<!-- tool-cta:start -->
💡 इसे आज़माएँ: DevTools से लिए गए कंट्रास्ट जोड़ों की जाँच करते समय, Color Converter hex, RGB और HSL के बीच रूपांतरण में मदद करता है, ताकि मान आपके ऑडिट नोट्स से मेल खाएँ।
<!-- tool-cta:end -->
No-install contrast audit checklist
जब आपको quick लेकिन credible audit चाहिए, तो यह sequence use करें:
- Production page को modern browser में खोलें.
- Main text, UI और state patterns list करें.
- DevTools में computed foreground और background colors inspect करें.
- Contrast पढ़ने के लिए built-in color picker या accessibility panel का उपयोग करें.
- Hover, focus, active, visited और invalid states force करें.
- Images और gradients पर text को worst plausible background के विरुद्ध check करें.
- Non-text UI parts को 3:1 requirement के विरुद्ध check करें.
- Built-in automated audit को safety net की तरह run करें, पूरे audit की तरह नहीं.
- Failures को component और token के अनुसार record करें.
- Barely threshold cross करके नहीं, margin के साथ fix करें.
अपने stack में एक और tool जोड़े बिना अधिकांश contrast issues पकड़ने के लिए यह पर्याप्त है. More advanced audits की जगह फिर भी है, खासकर large design systems, regulated products या complex data visualization के लिए. लेकिन कई websites के लिए, browser पहले से ही आपको वह evidence देता है जिसकी आपको ज़रूरत है. मुश्किल हिस्सा इतना systematic होना है कि आप उसका उपयोग कर सकें.