The sages instituted the lighting of Chanukah candles because it “takes us back” to the site of the miracle. We are therefore called upon to sense that our kindling of these candles is tantamount to the lighting of the menorah in the Holy Temple.
The purpose of "darkness" is to present man with a challenge - the challenge of strengthening his faith and uncovering God's presence. Because Joseph faced the trials of faith and stood up to them all, he merited the light of redemption.
The link between the feast of Joseph and his brothers in Egypt and the customary festive meal of Chanukah becomes clear. They together represent the attribute of trust in the Almighty.