Posted on 23/5/07 by Tim Koschützki
Today I stumbled upon a cool article that explains how one can control one's CSS colors via PHP to form relative shades. How is this done I hear you asking? Just look at the following code:
$base = new CSS_Color('C9E3A6');
$highlight = new CSS_Color('746B8E');
/* Use the base color, two shades darker */
background:#< ?= $base->bg['-2'] ?>;
/* Use the corresponding foreground color */
color:#< ?= $base->fg['-2'] ?>;
/* Use the highlight color as a border */
Note that we generate a CSS color object and then form lighter or darker shades of it using relativities. That could make generating cool design very easy. Just change the base color and with the relativities the entire design should change accordingly and still be eye-candy. Cool stuff isn't it? :)
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.