Changes in [650:0da4a5fecca3:651:4eeadbdfd558]
- Location:
- themes/ductile
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
themes/ductile/_config.php
r648 r649 80 80 } 81 81 82 return ''; 83 } 84 85 function computeContrastRatio($c,$b) 86 { 87 // Compute contrast ratio between two colors 88 89 $c = adjustColor($c); 90 if (($c == '') || (strlen($c) != 7)) return 0; 91 $b = adjustColor($b); 92 if (($b == '') || (strlen($b) != 7)) return 0; 93 94 $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)); 95 $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)); 96 97 if ($l1 > $l2) { 98 $r = ($l1 + 0.05) / ($l2 + 0.05); 99 } else { 100 $r = ($l2 + 0.05) / ($l1 + 0.05); 101 } 102 return $r; 103 } 104 105 function contrastRatio($c,$b) { 106 if (($c != '') && ($b != '')) { 107 $r = computeContrastRatio($c,$b); 108 return '<span style="position:absolute;top:0;left:23em;">('.sprintf(__('contrast ratio = %.1f:1'),$r).')</span>'; 109 } 82 110 return ''; 83 111 } … … 386 414 387 415 '<p class="field picker"><label for="blog_title_c">'.__('Color:').'</label> '. 388 form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker'). '</p>'.416 form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').contrastRatio($ductile_user['blog_title_c'],'#ffffff').'</p>'. 389 417 '</fieldset>'; 390 418 … … 400 428 401 429 '<p class="field picker"><label for="post_title_c">'.__('Color:').'</label> '. 402 form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker'). '</p>'.430 form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').contrastRatio($ductile_user['post_title_c'],'#ffffff').'</p>'. 403 431 '</fieldset>'; 404 432 … … 409 437 410 438 '<p class="field picker"><label for="post_simple_title_c">'.__('Color:').'</label> '. 411 form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker'). '</p>'.439 form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').contrastRatio($ductile_user['post_simple_title_c'],'#ffffff').'</p>'. 412 440 '</fieldset>'; 413 441 … … 417 445 418 446 '<p class="field picker"><label for="post_link_v_c">'.__('Normal and visited links color:').'</label> '. 419 form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker'). '</p>'.447 form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').contrastRatio($ductile_user['post_link_v_c'],'#ffffff').'</p>'. 420 448 421 449 '<p class="field picker"><label for="post_link_f_c">'.__('Active, hover and focus links color:').'</label> '. 422 form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker'). '</p>'.450 form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').contrastRatio($ductile_user['post_link_f_c'],'#ebebee').'</p>'. 423 451 '</fieldset>'; 424 452 … … 436 464 437 465 '<p class="field picker"><label for="blog_title_c_m">'.__('Color:').'</label> '. 438 form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker'). '</p>'.466 form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc').'</p>'. 439 467 '</fieldset>'; 440 468 … … 450 478 451 479 '<p class="field picker"><label for="post_title_c_m">'.__('Color:').'</label> '. 452 form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker'). '</p>'.480 form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').contrastRatio($ductile_user['post_title_c_m'],'#ffffff').'</p>'. 453 481 '</fieldset>'; 454 482 -
themes/ductile/locales/fr/admin.po
r612 r649 136 136 msgid "Monospace" 137 137 msgstr "Monospace" 138 139 msgid "contrast ratio = %.1f:1" 140 msgstr "ratio de contraste = %.1f:1"
Note: See TracChangeset
for help on using the changeset viewer.