How to add settings to custom Drupal themes

One feature I used to find missing in Drupal was the builtin ability to have themes include their own settings, like modules do.

For instance, a theme might allow switching renderings on the fly, without needing activation of specific stylesheets, or CSS or code tweaking, just by choosing parameters in an administration UI. But it was impossible. That is, until tonight.

Since a direct implementation in core seemed unlikely to see the day before 4.8/5.0, I created a proof-of-concept module just for this, called "themesettings".

The details and full source are available as a small demo which adds a "background" setting to a variant of the box_grey PHP theme, to define the background color of all nodes on the fly, just by choosing it from admin/themes/settings2/<chosen theme>. To read and download the code involved... :

The source is currently on the Audean wiki at http://wiki.audean.com/dr/themesettings until it's more polished and ready for Drupal.org.

Please try it, and feel free to comment, here or on IRC (#drupal, nick fgm).

UPDATE 2006-08-16 - The module is now available in my sandbox on drupal.org

UPDATE 2007-05-13 - That same idea has now become a fully supported contrib project under the hands of John Albin. Find it at http://drupal.org/project/themesettings . My sandbox code is therefore now obsoleted by this module and should no longer be used, except for history purposes.