Here is my version. It will blend two colors together in as many steps
as you want.
<cfscript>
fromRed = inputBaseN(left(form.fromColor,2),16);
fromGreen = inputBaseN(mid(form.fromColor,3,2),16);
fromBlue = inputBaseN(right(form.fromColor,2),16);
toRed = inputBaseN(left(form.toColor,2),16);
toGreen = inputBaseN(mid(form.toColor,3,2),16);
toBlue = inputBaseN(right(form.toColor,2),16);
redStep = (toRed - fromRed)/(form.step - 1);
greenStep = (toGreen - fromGreen)/(form.step - 1);
blueStep = (toBlue - fromBlue)/(form.step - 1);
red = fromRed;
green = fromGreen;
blue = fromBlue;
blendedDivs = "";
blendedStyles = "";
for (i=1; i LTE form.step; i = i + 1)
{
blendedDivs = blendedDivs & '<div class="blend" id="step#i#"
title="#UCase(hexColor(red)&hexColor(green)&hexColor(blue))#"> </div>'
& chr(13) & chr(10);
blendedStyles = blendedStyles & 'div##step#i#
{background-color: ###hexColor(red)##hexColor(green)##hexColor(blue)#}'
& chr(13) & chr(10);
red = red + redStep;
green = green + greenStep;
blue = blue + blueStep;
}
</cfscript>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318032
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4