# Commits

Merge

• Participants
• Branches themes

# File themes/ductile/_config.php

` 	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 '';`
`+}`
`+`
` \$ductile_base = array(`
` 	// HTML`
` 	'subtitle_hidden' => null,`
` form::field('blog_title_s',7,7,\$ductile_user['blog_title_s']).'</p>'.`
` `
` '<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>';`
` `
` echo '</div>';`
` form::field('post_title_s',7,7,\$ductile_user['post_title_s']).'</p>'.`
` `
` '<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>';`
` `
` echo '</div>';`
` echo '<fieldset><legend>'.__('Titles without link').'</legend>'.`
` `
` '<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>';`
` `
` echo '<fieldset><legend>'.__('Inside posts links').'</legend>'.`
` form::checkbox('post_link_w',1,\$ductile_user['post_link_w']).'</label>'.'</p>'.`
` `
` '<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>';`
` `
` echo '<h3>'.__('Mobile specific settings').'</h3>';`
` form::field('blog_title_s_m',7,7,\$ductile_user['blog_title_s_m']).'</p>'.`
` `
` '<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>';`
` `
` echo '</div>';`
` form::field('post_title_s_m',7,7,\$ductile_user['post_title_s_m']).'</p>'.`
` `
` '<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>';`
` `
` echo '</div>';`

` `
` msgid "Monospace"`
` msgstr "Monospace"`
`+`
`+msgid "contrast ratio = %.1f:1"`
`+msgstr "ratio de contraste = %.1f:1"`