ID:151837
 
Well I was just wanting to know would this work? It's meant to slowly alternate from one color back
mob/proc/Color_Swap(Color as text, delay as num,speed as num)
var/old_icon = src.icon
switch(Color)
if("Red")
for(var/I, I = delay, I--)
src.icon += rgb(speed,0,0)
for(var/O, O = delay, O--)
src.icon -= rgb(speed,0,0)
if("Blue")
for(var/I, I = delay, I--)
src.icon += rgb(0,0,speed)
for(var/O, O = delay, O--)
src.icon -= rgb(0,speed,0)
if("Green")
for(var/I, I = delay, I--)
src.icon += rgb(0,speed,0)
for(var/O, O = delay, O--)
src.icon -= rgb(0,speed,0)
if("Transperant")
for(var/I, I = delay, I--)
src.icon += rgb(0,0,0,speed)
for(var/O, O = delay, O--)
src.icon -= rgb(0,0,0,speed)

i tried it and it didnt work...i put something together quick that i think works.....i think :P
(o it uses sd_procs library)
mob/proc/Color_Swap(color="#FFFFFF",delay=1,speed=2,pause=5)
var/maxcolor = 255
var/sd_color/o = new
o.html = copytext(color,findtext(color,"#")+1,0)
o.html2rgb()
speed = speed*2
for(var/I=0,I<maxcolor)
sleep(delay)
src.icon += rgb(o.red/speed,o.green/speed,o.blue/speed)
I+=max(o.red/speed,o.green/speed,o.blue/speed)
sleep(pause)
for(var/I=0,I<maxcolor)
sleep(delay)
src.icon -= rgb(o.red/speed,o.green/speed,o.blue/speed)
I+=max(o.red/speed,o.green/speed,o.blue/speed)


You could use LummoxJR's IconProcs. It uses MapColors(), a new feature in BYOND 4.0.

The way you're doing it, it's going go back gray. For the decreasing, you're going to want to revert to the initial icon, then add rgb(), but less than it had.
Your transparency part won't work, because adding and subtracting it is the same thing.