I use a sharpie. Silver works good on dark surfaces. I own several Glocks includinga G20 and G21 and it really makes identifying which mags go with each gun easy. It will wear off with time, but lasts plenty long especially on plastic parts. You can get it off if you want later. I not only write the guns model number, but the type of ammo in the magazine.
I have 15-20 AR magazines, loaded with different ammo weights and types. Same with my handguns. If I change the type of ammo in that magazine I can rub it off with 0000 steel wool and a little oil. I do the same with handgun magazines.
About once per year I may have to brighten up what I have written on the magazines. It gets a little faded by that time, but is still legible.