Thread:Project:Support desk/Grandparent categories?

I'm looking for something like getGrandparentCategories. On an article I want to check if the page's categories are in a certain category.

Example:
 * article "Banana" is in categories
 * "Category:Fruits"
 * "Category:Yellow objects"
 * "Category:Yellow objects" is in category
 * "Category:Colorful objects"

On the article "Banana", how can I find out if it's a colorful object without knowing "Category:Yellow objects" or defining a list of related categories?