Dotclear


Ignore:
Location:
themes/ductile
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_config.php

    r648 r649  
    8080     } 
    8181 
     82     return ''; 
     83} 
     84 
     85function 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 
     105function 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     } 
    82110     return ''; 
    83111} 
     
    386414 
    387415'<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>'. 
     416form::field('blog_title_c',7,7,$ductile_user['blog_title_c'],'colorpicker').contrastRatio($ductile_user['blog_title_c'],'#ffffff').'</p>'. 
    389417'</fieldset>'; 
    390418 
     
    400428 
    401429'<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>'. 
     430form::field('post_title_c',7,7,$ductile_user['post_title_c'],'colorpicker').contrastRatio($ductile_user['post_title_c'],'#ffffff').'</p>'. 
    403431'</fieldset>'; 
    404432 
     
    409437 
    410438'<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>'. 
     439form::field('post_simple_title_c',7,7,$ductile_user['post_simple_title_c'],'colorpicker').contrastRatio($ductile_user['post_simple_title_c'],'#ffffff').'</p>'. 
    412440'</fieldset>'; 
    413441 
     
    417445 
    418446'<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>'. 
     447form::field('post_link_v_c',7,7,$ductile_user['post_link_v_c'],'colorpicker').contrastRatio($ductile_user['post_link_v_c'],'#ffffff').'</p>'. 
    420448 
    421449'<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>'. 
     450form::field('post_link_f_c',7,7,$ductile_user['post_link_f_c'],'colorpicker').contrastRatio($ductile_user['post_link_f_c'],'#ebebee').'</p>'. 
    423451'</fieldset>'; 
    424452 
     
    436464 
    437465'<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>'. 
     466form::field('blog_title_c_m',7,7,$ductile_user['blog_title_c_m'],'colorpicker').contrastRatio($ductile_user['blog_title_c_m'],'#d7d7dc').'</p>'. 
    439467'</fieldset>'; 
    440468 
     
    450478 
    451479'<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>'. 
     480form::field('post_title_c_m',7,7,$ductile_user['post_title_c_m'],'colorpicker').contrastRatio($ductile_user['post_title_c_m'],'#ffffff').'</p>'. 
    453481'</fieldset>'; 
    454482 
  • themes/ductile/locales/fr/admin.po

    r612 r649  
    136136msgid "Monospace" 
    137137msgstr "Monospace" 
     138 
     139msgid "contrast ratio = %.1f:1" 
     140msgstr "ratio de contraste = %.1f:1" 
Note: See TracChangeset for help on using the changeset viewer.

Sites map