If possible, prepare for withdrawal depression before quitting by thinking of some non-drug ways of cheering yourself up when you get the blues. Supportive people, low-key entertainment such as a favourite comedy movie, and good self-care practices can ease this unhappy time.
Remember, withdrawal depression is temporary, and only lasts for the first few days after you stop taking the drug. If your mood changes are severe, last longer than your other withdrawal symptoms, or include thoughts of harming yourself or suicide, seek support immediately.
You may be experiencing substance-induced mood disorder, or you may have had a pre-existing mood disorder which was masked by your drug use. Either way, your doctor can help get you proper treatment.