I have taxonomy list of color names(red, black, etc). If I create an exposed filter form, how can I show the color with corresponding coloring? I want to style each select option with background color, i.e for the option Red, the background should be red. Can we style that in the stylesheet?

I use view3 and views_hacks thanks.

1 Answer 1


What you're asking is not necessarily Drupal related (although there is the Color module which also shows a color value in a select list, you could look into using the Color module to use its select widget or colorpicker instead of a taxonomy listing of colors by English name).

Anyways, if you want to stick with using a taxonomy select with like "blue" being the 3rd option in the select list -- you could reference this StackOverflow example using Jquery to style select items. You could make a call to drupal_add_js() in a theme function whenever your view and its filters are shown on the page to add the necessary jquery.

I would recommend looking into the Color module in the long run.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.