While the existing two answers are good ones that explain how to parse the phrase (as you guessed, "How lucky it is that the cat is a black one"), I think they are missing a bit of context that may further explain the joke: black cats can (in English culture) be considered to be unlucky.
This article cites a possible origin of the superstition as far back as 1233.
“It begins with Pope Gregory IX in 1233 when he issues the papal bull, Vox in Rama, that began the Inquisition and the church sanction, heretic and witch hunts,” explained Meghan Henning, associate professor of Christian origins at the University of Dayton. “In that 1233 document, he says that black cats were an incarnation of Satan.”
The Dictionary of English Folklore indicates that 67% of respondents to a 1998 survey were aware of the existence of a superstition about black cats, though there were mixed responses about whether black cats are supposed to be lucky or unlucky.
Beliefs concerning cats, especially *black ones, are numerous and often contradictory [...] On the whole, black cats are lucky in England, and therefore appear on greetings cards and as *charms; however, informants from several counties say it is unlucky if one crosses your path [...]
This source dates the existence of a black cat superstition in England to at least the 17th century.
I'll admit it's just an informed guess that historical readers of this paper would be expected to have an awareness of the idea that black cats can cause bad luck: I'm making an assumption that the paper is British (based on the phrasing of the joke) and that the modern questionnaire showing fairly broad familiarity with the superstition in England can be extrapolated back to readers two centuries earlier. But this background can make the joke feel like... well, more of a joke.
Armed with this context, the child's comment can be seen as morbidly ironic: while they are innocently expressing that it's fortunate that the cat is in mourning colours appropriate for their father's death, it is implied that the family owning a black cat is the ultimate cause of their misfortune. If the cat had not been unlucky black, there would be no need for anyone to wear mourning colours at all.