عالميمجاني

مدقق تباين الألوان (WCAG AA وAAA)

تحقق من نسبة التباين بين لون النص ولون خلفيته، واعرف هل يجتاز مستويي WCAG 2 AA وAAA للنص العادي والنص الكبير وعناصر الواجهة.

تبقى مدخلاتك في علامة التبويب هذه. لا نتلقى ملفاتك أو النصوص الملصقة أو قيم الحسابات.

المدخلات

تلميح: اضغط Ctrl + Enter للتشغيل

نتيجتك

ستظهر نتيجتك هنا.

المساعدة المفصلة أدناه متاحة بالإنجليزية فقط حاليًا.

حول هذه الأداة

Low-contrast text is one of the most common accessibility problems on the web, and it also hurts anyone reading a phone in sunlight. This checker takes a text colour and a background colour as hex codes, calculates the WCAG 2 contrast ratio and shows whether the pair passes level AA and AAA for normal text, large text and interface parts such as icons and form borders.

طريقة الاستخدام

  1. Enter the text colour as a hex code, such as #777777 or the short form #777.
  2. Enter the background colour the text sits on, such as #FFFFFF for white.
  3. Run it to see the ratio and a pass or fail for each WCAG level.
  4. If a level fails, darken the text or lighten the background a step at a time and run it again until it passes.

كيف يعمل الحساب

Each colour is converted from sRGB to linear light, then to relative luminance with L = 0.2126 R + 0.7152 G + 0.0722 B, as defined in WCAG 2. The ratio is (lighter L + 0.05) ÷ (darker L + 0.05), which ranges from 1:1 for identical colours to 21:1 for black on white. The pass and fail checks use the unrounded ratio, and the displayed ratio is cut to two decimals rather than rounded up, so a value just under a threshold is never shown as passing.

ratio = (L1 + 0.05) ÷ (L2 + 0.05), L = 0.2126 R + 0.7152 G + 0.0722 B (linearized sRGB)

مثال تطبيقي

A designer uses #777777 grey for body text on a white page. The ratio is 4.47:1, which fails WCAG AA for normal text (4.5:1 needed) but passes for large text and for icons (3:1). Darkening the grey to #595959 brings the ratio to 7:1, which passes every level, including AAA for normal text.

مثال على الإدخال والنتيجة

#767676 على #FFFFFF = 4.54:1، يجتاز AA للنص العادي

القيود

  • Solid colours only. Semi-transparent colours, gradients and text over photos must be checked at the lightest and darkest points of the real background.
  • It applies the WCAG 2 formula. The APCA method proposed for WCAG 3 gives different numbers and is not calculated.
  • A passing ratio does not cover thin fonts, tiny sizes or colour-only meaning, which still need a human check.

المصادر

آخر تحديث:

الأسئلة الشائعة

ما نسبة التباين التي أحتاجها؟

يتطلب مستوى WCAG AA نسبة 4.5:1 للنص العادي و3:1 للنص الكبير وللأيقونات أو حدود حقول النماذج. ويتطلب مستوى AAA نسبة 7:1 و4.5:1.

هل يهم ترتيب اللونين؟

لا. تقسم النسبة دائمًا اللون الأفتح على الأغمق، لذا يعطي تبديل النص والخلفية الرقم نفسه.

الأسئلة الشائعة

What counts as large text?

WCAG treats text as large from 18 point (24 CSS pixels) at normal weight, or 14 point (about 18.7 pixels) when bold. Everything smaller needs the normal-text ratio.

Do logos and disabled buttons need to pass?

No. WCAG exempts logos and text in inactive controls, as well as purely decorative text. Active icons, focus outlines and input borders need 3:1 against their surroundings.

Can I check RGB or HSL colours?

Convert them to hex first with the colour converter, then paste the hex codes here.

استكشاف الأخطاء وإصلاحها

It says to enter colours as hex codes.

Use 3 or 6 hexadecimal digits, with or without #, such as #0A84FF or 0af. Names like “navy” and rgb() values are not accepted.

My design tool shows 4.5:1 but this shows 4.49:1.

Some tools round to one decimal. WCAG says the ratio must not be rounded up, so 4.49:1 is a fail.

The result is the same when I swap the colours.

That is expected: the ratio always compares the lighter colour with the darker one.

الخصوصية & مجاني

هل تُخزَّن مدخلاتي؟

تبقى مدخلاتك في علامة التبويب هذه. لا نتلقى ملفاتك أو النصوص الملصقة أو قيم الحسابات.

هل هذه الأداة مجانية؟

نعم. لا يلزم تسجيل أو دفع.

تتم المعالجة في متصفحك

خطوات تالية مفيدة