JQuery_ Novice to Ninja - Earle Castledine [148]
Making Your Components Themeable
ThemeRoller may have a groovy-sounding name, and the results you gain from it may be fairly impressive—but all it’s really doing is generating a block of CSS classes that can be used to style any set of DOM elements. If you build your own custom UI components in a way that follows the jQuery UI’s markup and naming conventions, they’ll be also be skinnable.
In Figure 9.3 we’ve applied the appropriate CSS classes to the bouncy content panes from Chapter 3, so now we have a very jQuery UI-like component. The default themes (or our custom ThemeRoller themes) can be included at the top of our page, and our chameleon widget will instantly have a new look and feel (the figure shows the UI lightness, Dot Luv, and Eggplant predesigned themes in action).
Figure 9.3. ThemeRolled content panes
If you’re accustomed to building semantically correct structures, you’ll probably only need to add a class here and there to access all of the ThemeRoller goodness. The themes assume your widget will have at least a containing element that it can use as the base for styling. Our original HTML for the biography panes looked like this:
Beau Dandy

Glendatronix is the queen of …
Mr Speaker

After smashing into the limelight …
…
To start off, we’ll designate the #bio div as the container by applying the ui-widget class. Then we’ll reset any styles we may have already applied that might mess up the widget styling, by adding ui-helper-reset:
chapter_09/17_themable_components/index.html (excerpt)
