Index: themes/ductile/_config.php
===================================================================
--- themes/ductile/_config.php	(revision 648)
+++ themes/ductile/_config.php	(revision 649)
@@ -80,4 +80,32 @@
 	}
 
+	return '';
+}
+
+function computeContrastRatio($c,$b)
+{
+	// Compute contrast ratio between two colors
+	
+	$c = adjustColor($c);
+	if (($c == '') || (strlen($c) != 7)) return 0;
+	$b = adjustColor($b);
+	if (($b == '') || (strlen($b) != 7)) return 0;
+	
+	$l1 = (0.2126 * pow(hexdec(substr($c,1,2))/255,2.2)) + (0.7152 * pow(hexdec(substr($c,3,2))/255,2.2)) + (0.0722 * pow(hexdec(substr($c,5,2))/255,2.2));
+	$l2 = (0.2126 * pow(hexdec(substr($b,1,2))/255,2.2)) + (0.7152 * pow(hexdec(substr($b,3,2))/255,2.2)) + (0.0722 * pow(hexdec(substr($b,5,2))/255,2.2));
+
+	if ($l1 > $l2) {
+		$r = ($l1 + 0.05) / ($l2 + 0.05);
+	} else {
+		$r = ($l2 + 0.05) / ($l1 + 0.05);
+	}
+	return $r;
+}
+
+function contrastRatio($c,$b) {
+	if (($c != '') && ($b != '')) {
+		$r = computeContrastRatio($c,$b);
+		return '<span style="position:absolute;top:0;left:23em;">('.sprintf(__('contrast ratio = %.1f:1'),$r).')</span>';
+	}
 	return '';
 }
@@ -386,5 +414,5 @@
 
 '<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '.
-form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').'</p>'.
+form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').contrastRatio($ductile_user['blog_title_c'],'#ffffff').'</p>'.
 '</fieldset>';
 
@@ -400,5 +428,5 @@
 
 '<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '.
-form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').'</p>'.
+form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').contrastRatio($ductile_user['post_title_c'],'#ffffff').'</p>'.
 '</fieldset>';
 
@@ -409,5 +437,5 @@
 
 '<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '.
-form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').'</p>'.
+form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').contrastRatio($ductile_user['post_simple_title_c'],'#ffffff').'</p>'.
 '</fieldset>';
 
@@ -417,8 +445,8 @@
 
 '<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '.
-form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').'</p>'.
+form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').contrastRatio($ductile_user['post_link_v_c'],'#ffffff').'</p>'.
 
 '<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '.
-form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').'</p>'.
+form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').contrastRatio($ductile_user['post_link_f_c'],'#ebebee').'</p>'.
 '</fieldset>';
 
@@ -436,5 +464,5 @@
 
 '<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '.
-form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').'</p>'.
+form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc').'</p>'.
 '</fieldset>';
 
@@ -450,5 +478,5 @@
 
 '<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '.
-form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').'</p>'.
+form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').contrastRatio($ductile_user['post_title_c_m'],'#ffffff').'</p>'.
 '</fieldset>';
 
Index: themes/ductile/locales/fr/admin.po
===================================================================
--- themes/ductile/locales/fr/admin.po	(revision 612)
+++ themes/ductile/locales/fr/admin.po	(revision 649)
@@ -136,2 +136,5 @@
 msgid "Monospace"
 msgstr "Monospace"
+
+msgid "contrast ratio = %.1f:1"
+msgstr "ratio de contraste = %.1f:1"
