According to the dictionary, a definition for the colony is:
A body of people living in a new territory but retaining ties with the parent state
And two European cities in Morocco seem to be "people living in a new territory but retaining ties with the parent state".
Another definition from Wikipedia is:
In political science, a colony is a territory subject to a form of foreign rule. Though dominated by the foreign colonizers, colonies remain separate from the administration of the original country of the colonizers, the metropolitan state (or "mother country")
In this case, there is a "foreign rule" but Ceuta and Melilla are not separated "from the administration of the original country of the colonizers".
I've seen this map where Gibraltar is considered as "Non-self governing territory" (like Western Sahara from Spain) but Ceuta and Melilla don't appear.
I've found also this article where a Spanish ambassador says about to compare Ceuta and Melilla with Gibraltar:
"It is absurd to compare them," he said. "[Ceuta and Melilla] have never been colonies and are not now."
So, Ceuta and Melilla cities have never been colonies and also are not colonies now. But why? Why is another example as Gibraltar is considered a colony but not two cities on another continent?