ID:156526
 
I was wondering, I've been trying to get colors to be swapped for a atom when its' spawned to pre-defined colors, but it hasn't been working. Even when I reference it's icon as something like obj.icon or var/x=obj:icon , can someone please help?
Do not use :, that is a very bad abuse.

Most likely the problem is that you do not have an new instance of an /icon reference.

Something AKIN to this will work:
var/icon/I = new(src)
I.SwapColor(old_rgb_hex, new_rgb_hex)
// Hex can be entered as "#RRGGBB[AA]" or simply using the rgb() procedure. AA refers to the alpha hex, if any.
src.icon = I