Style Switcher

Roger López - February 21, 2009 - 04:42

This module takes the fuss out of creating a theme with alternate stylesheets. The module takes care of outputting the appropriate markup and javascript, leaving only the stylesheet portion of the work up to the themer. Implementing this in your theme is a simple 2 step process:

  1. Create stylesheet(s) for each different style. Note that each stylesheet is added to the existing set of default stylesheets.
  2. Add a line to your theme's info file like
    styleswitcher[css][Style 2] = css/style2.css
    where "Style 2" is the title associated with you style, and css/style2.css is the location of the stylesheet, relative to the theme's path.

That's it. The module will present a block with links for each of these styles. It is much like the color module; in order to use it you must have the module enabled AND use a theme that implements it.

To read more about how alternate stylesheets are implemented in browsers, see this *old* A List Apart article.

Downloads



 
 

Drupal is a registered trademark of Dries Buytaert.