...and just to make it clear, it is not the colors but the palette indexes (where they are located in the Slots) that matter.
You can use any color as the transparent background but it must also be in the correct palette slot.
One could also use colors that are in the image as the transparent colors if all is understood but for ease of use it is generally best to use colors Not found in the image... thus the Magenta and Green colors are generally used.
...simply look at the palettes used in the game to SEE what was placed for the transparent colors and where they are on the palette... otherwise, remember it is the palette slots we have to be aware of because they are programed for particular things.
There are different palettes used in the game for different graphics but all use two Transparent Colors on the 256 color palette.
There are palette tutorials available here in the tutorials section.