? color_module_variable_fields.patch
? kill_post_node_4.patch
? sites/all/modules
? sites/all/themes
? sites/default/settings.php
Index: modules/color/color.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.module,v
retrieving revision 1.24
diff -u -p -r1.24 color.module
--- modules/color/color.module	6 Aug 2007 12:54:39 -0000	1.24
+++ modules/color/color.module	10 Aug 2007 19:34:15 -0000
@@ -18,15 +18,19 @@ function color_form_alter(&$form, $form_
   // Insert the color changer into the theme settings page.
   // TODO: Last condition in the following if disables color changer when private files are used this should be solved in a different way. See issue #92059.
   if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info') && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
-    $form['color'] = array(
-      '#type' => 'fieldset',
-      '#title' => t('Color scheme'),
-      '#weight' => -1,
-      '#attributes' => array('id' => 'color_scheme_form'),
-      '#theme' => 'color_scheme_form',
-    );
-    $form['color'] += color_scheme_form($form_state, arg(4));
-    $form['#submit'][] = 'color_scheme_form_submit';
+    $info = color_get_info(arg(4));
+    // Only themes with field as a base get to be colorized - big errors if not
+    if(isset($info['fields']['base'])) {
+      $form['color'] = array(
+        '#type' => 'fieldset',
+        '#title' => t('Color scheme'),
+        '#weight' => -1,
+        '#attributes' => array('id' => 'color_scheme_form'),
+        '#theme' => 'color_scheme_form',
+      );
+      $form['color'] += color_scheme_form($form_state, arg(4), $info);
+      $form['#submit'][] = 'color_scheme_form_submit';
+    }
   }
 
   // Use the generated screenshot in the theme list
@@ -70,6 +74,16 @@ function color_get_info($theme) {
   $file = $path .'/color/color.inc';
   if ($path && file_exists($file)) {
     include $file;
+    // Set default fields
+    if(!isset($info['fields'])) {
+      $info['fields'] = array(
+        'base' => t('Base color'),
+        'link' => t('Link color'),
+        'top' => t('Header top'),
+        'bottom' => t('Header bottom'),
+        'text' => t('Text color')
+      );
+    }
     return $info;
   }
 }
@@ -79,8 +93,8 @@ function color_get_info($theme) {
  */
 function color_get_palette($theme, $default = false) {
   // Fetch and expand default palette
-  $fields = array('base', 'link', 'top', 'bottom', 'text');
   $info = color_get_info($theme);
+  $fields = array_keys($info['fields']);
   $keys = array_keys($info['schemes']);
   foreach (explode(',', array_shift($keys)) as $k => $scheme) {
     $palette[$fields[$k]] = $scheme;
@@ -90,12 +104,12 @@ function color_get_palette($theme, $defa
   return $default ? $palette : variable_get('color_'. $theme .'_palette', $palette);
 }
 
+
 /**
  * Form callback. Returns the configuration form.
  */
-function color_scheme_form(&$form_state, $theme) {
+function color_scheme_form(&$form_state, $theme, $info) {
   $base = drupal_get_path('module', 'color');
-  $info = color_get_info($theme);
 
   // Add Farbtastic color picker
   drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
@@ -124,18 +138,11 @@ function color_scheme_form(&$form_state,
 
   // Add palette fields
   $palette = color_get_palette($theme);
-  $names = array(
-    'base' => t('Base color'),
-    'link' => t('Link color'),
-    'top' => t('Header top'),
-    'bottom' => t('Header bottom'),
-    'text' => t('Text color')
-  );
   $form['palette']['#tree'] = true;
   foreach ($palette as $name => $value) {
     $form['palette'][$name] = array(
       '#type' => 'textfield',
-      '#title' => $names[$name],
+      '#title' => $info['fields'][$name],
       '#default_value' => $value,
       '#size' => 8,
     );
@@ -321,11 +328,11 @@ function _color_rewrite_stylesheet($them
       // Determine the most suitable base color for the next color.
 
       // 'a' declarations. Use link.
-      if (preg_match('@[^a-z0-9_-](a)[^a-z0-9_-][^/{]*{[^{]+$@i', $chunk)) {
+      if (preg_match('@[^a-z0-9_-](a)[^a-z0-9_-][^/{]*{[^{]+$@i', $chunk) && isset($info['fields']['link'])) {
         $base = 'link';
       }
       // 'color:' styles. Use text.
-      else if (preg_match('/(?<!-)color[^{:]*:[^{#]*$/i', $chunk)) {
+      else if (preg_match('/(?<!-)color[^{:]*:[^{#]*$/i', $chunk) && isset($info['fields']['text'])) {
         $base = 'text';
       }
       // Reset back to base.
