I have a site where each product image has a 1px solid border. The colour of the border is currently black. However, I would like the colour of the border to be definied by the category; for example all products with the parent category 'blue' should have a blue border, and all products with the parent category 'red' should have a red border and so on.
Is this achievable in Magento? I know the body tag of the page is given a unique CSS reference but I want the product image border colour to be defined by the top level category, not the child of that category.
Any ideas welcome!