I have heard that melanoma under the nail is usually red, brown or black. I have never heard of a case where it has been yellow. And it is usually always a longitudinal line that thickens and becomes darker. It would usually start out as being red or light brown and then eventually get darker over time. But it is a gradual process. It wouldn't just become dark and get bigger over a few nights or weeks.
But like I said, I am no doctor. If it is an infection, then you may need antibiotics. If it is just blood under the nail, it will eventually heal without any treatment. But you shouldn't be worrying about it being a melanoma.