The other Patrick Fitzgerald rocks.
Not talking about the one who Bush and Cheney wish was dead…though I’m sure he’s cool in his own “get your depostion on” sort of way. Fitzgerald I’m talking about is the other one, the web designer/developer.
He’s rocks because he documented an elegant solution to a quite common web accessibility challenge.

I was exploring ways to formulaically + dynamically set a web page’s text color based on the background color that the text was being displayed on. For example, if a page’s background was black I wanted the text on that page to automagically be white or whatever other color was easiest on the eyes to read against a black background.
Specific uses would be any kind of cool web product where users are allowed to personalize their instance’s colors, and you want to either enforce or suggest a color scheme based on the choices they make. If MySpace had this in place, sweet god would the Internet be a prettier place. Some of the user selected palettes I’ve seen there have sent more children into epiletic fits than Pokemon.
Methods of generating dynamic CSS to handle stuff like this have been explained a bunch of times in a bunch of different places…but Patrick’s explanation brought it together using PHP (programming language I work in most) & web page color contrast guidelines recommended by the W3C (who are kinda like the U.N. of the Internet…except with balls).
Thanks for the code patterns, Fitzy. You rock.



Patrick Fitzgerald : Dec 06 2006
thanks for the link, and I’m glad the code was useful