hi there, looks like you bruised yourself in your sleep causing a small hematoma
which has resolved over a period of time. Hematoma is a collection of blood outside the blood vessel and is reabsorbed slowly over a period of 1week to 14 days depending on the size. Sometime hemosidirin pigment released from the blood gets absorbed in the surrounding tissue giving it a permanent pigmentation which appears purple or brown. As long as the site is not hurting you and the pigmentation is not serious cosmetically you can leave it alone and it will disappear gradually over a period of time, but if it is disfiguring or debelitating in any form then you may consult a cosmetic surgeon for the same. Take care.