Hi Thanks for using HCM.
With your history it looks like tendon or ligament tear during night. Colour change and swelling is due to internal bleeding
Dont move the joint now, apply a bandage over it to prevent further bleeding and consult your orthopedician. You may have to take one Xray and if required surgery to correct it.
Hope I answered your question. Wish you good health. Take care.