If it came on suddenly, it's far more likely to be a hemorrhage than a melanoma. Also, melanomas start right at the base of the nail, whereas I think I understand from your description that yours doesn't. Also, hemorrhages are far more common than pigmented lesions under the nail, benign or otherwise.
My advice: wait a month and see if the color is growing out, as I'm confident it will. If you have any doubts at that point, show a skin doctor.