I understand but I am refreshing the surface manually and every step the surface is drawn from complete zero. So I imitate GM onscreen drawing. I suspect (unsure) that the problem is in GM blending mode.
1 - If I simply draw an opaque black background and then a semi-transparent white spot on top, GM blends them, right?
2 - If I draw the opaque black background and then the semi-transparent white spot on top into a surface, at drawing onscreen, this should look exactly like in (1), shouldn't it? As long as GM refreshes the screen and I am drawing anew. Am I missing anything?
Well, you put that code into a script called "random_color" and call it like this:
draw_sprite_ext(sprite_index, image_index, x, y, image_angle, random_color(), alpha);
About matching colors, you have to think numbers, not colors so have 3 vars red, green, blue; i.e if you input a RED value that matches "red" have GM do the thing. That's pretty obvious but still...; and if you want to do something based on how close you are to the color you can use
I can't describe the frustration I had once with a similar issue. It took me several days until I knocked it down. I don't say it's your case too but it might be. I don't know about Studio but the legacy GM seem not to have a consistent order of creating objects (or at least so I took it). Merely creating instances in an express, obvious order has solved it. Until then I was residing on instances id -- bad way.