Skip to content

Commit 4e6d9ab

Browse files
committed
phpinfo HTML accessibility: Fix the color contrast for "no value" labels
The HTML output of `phpinfo()` function has a little bit of CSS to improve the readability of PHP configuration values. Previously, the background color was `#dddddd`, while the text color for "no value" label was `#999999`. This resulted in a contrast ratio of 2.10, which did not meet he WCAG minimum text contrast guidelines. This increases the contrast ratio to 7.06 (AAA grade) by changing the text color to `#454545`. On dark theme (`prefers-color-scheme: dark`), the text color is changed from `#999999` to `#c4c4c4`. The new colors are calculated by adjusting the "lightness" factor of the current colors using LCH (Lightness, Chroma, Hue) sampling. The lightness is decreased (increased, in case for dark theme) until the new color achieves an AAA score in WCAG guidelines.
1 parent 296f764 commit 4e6d9ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/standard/css.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ PHPAPI ZEND_COLD void php_info_print_css(void) /* {{{ */
3535
PUTS(".e {background-color: #ccf; width: 300px; font-weight: bold;}\n");
3636
PUTS(".h {background-color: #99c; font-weight: bold;}\n");
3737
PUTS(".v {background-color: #ddd; max-width: 300px; overflow-x: auto; word-wrap: break-word;}\n");
38-
PUTS(".v i {color: #999;}\n");
38+
PUTS(".v i {color: #454545;}\n");
3939
PUTS("img {float: right; border: 0;}\n");
4040
PUTS("hr {width: 934px; background-color: #ccc; border: 0; height: 1px;}\n");
4141
PUTS(":root {--php-dark-grey: #333; --php-dark-blue: #4F5B93; --php-medium-blue: #8892BF; --php-light-blue: #E2E4EF; --php-accent-purple: #793862}");
@@ -47,6 +47,7 @@ PHPAPI ZEND_COLD void php_info_print_css(void) /* {{{ */
4747
" .e {background-color: #404A77}\n"
4848
" .h {background-color: var(--php-dark-blue)}\n"
4949
" .v {background-color: var(--php-dark-grey)}\n"
50+
" .v i {color: #c4c4c4;}\n"
5051
" hr {background-color: #505153}\n"
5152
"}\n"
5253
);

0 commit comments

Comments
 (0)