While experimenting with compositing images in SDL2 on Linux, I get a dark edge around my textures. In the image below, you can see the top example, where I composited the cyan image on top of the blue/magenta image in GIMP, looks correct but the bottom example, which is done using SDL_RenderCopy, is darker around the edges.
This looks like a color correction / gamma issue. Premultiplying the alpha channel only helps with issues caused by texture filtering (that can cause similar artifacts).
I tested same colors with gimp and funnily I’m actually getting the dark borders there too. Seems that support for linear color spaces is implemented in gimp 2.9 and I was using 2.8.x. Are you using 2.9?
There doesn’t seem to be a super simple solution to the problem when using the SDL api for drawing. When drawing with OpenGL directly you can do color correction in a shader or for sRGB output just call:
glEnable(GL_FRAMEBUFFER_SRGB);
It’s probably possible to use GL_FRAMEBUFFER_SRGB with the SDL drawing api too, but you have to force SDL to use OpenGL as the rendering backend.