Index: image_captcha/image_captcha.css
===================================================================
RCS file: image_captcha/image_captcha.css
diff -N image_captcha/image_captcha.css
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ image_captcha/image_captcha.css	3 Dec 2007 09:02:47 -0000
@@ -0,0 +1,4 @@
+
+#colorpicker {
+  float: right;
+}
Index: image_captcha/image_captcha.js
===================================================================
RCS file: image_captcha/image_captcha.js
diff -N image_captcha/image_captcha.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ image_captcha/image_captcha.js	3 Dec 2007 09:02:47 -0000
@@ -0,0 +1,78 @@
+
+if (Drupal.jsEnabled) {
+  $(document).ready(function () {
+    var form = $('#image_captcha_colors');
+    var inputs = [];
+    var focused = null;
+
+    // Add Farbtastic
+    $(form).prepend('<div id="colorpicker"></div>');
+    var farb = $.farbtastic('#colorpicker');
+
+    // Set up colorscheme selector
+    $('#edit-image-captcha-color-scheme', form).change(function () {
+      var colors = this.options[this.selectedIndex].value;
+      if (colors != '') {
+        colors = colors.split(',');
+        for (i in colors) {
+          callback(inputs[i], colors[i], true);
+        }
+      }
+    });
+
+    /**
+     * Callback for Farbtastic when a new color is chosen.
+     */
+    function callback(input, color, colorscheme) {
+      // Set background/foreground color
+      $(input).css({
+        backgroundColor: color,
+        color: farb.RGBToHSL(farb.unpack(color))[2] > 0.5 ? '#000' : '#fff'
+      });
+      // Change input value
+      if (input.value && input.value != color) {
+        input.value = color;
+        // Reset colorscheme selector
+        if (!colorscheme) {
+          resetScheme();
+        }
+      }
+    }
+
+    /**
+     * Reset the color scheme selector.
+     */
+    function resetScheme() {
+      $('#edit-image-captcha-color-scheme', form).each(function () {
+        this.selectedIndex = this.options.length - 1;
+      });
+    }
+
+    // Focus the Farbtastic on a particular field.
+    function focus() {
+      var input = this;
+      // Remove old bindings
+      focused && $(focused).unbind('keyup', farb.updateValue)
+          .unbind('keyup', resetScheme)
+          .parent().removeClass('item-selected');
+
+      // Add new bindings
+      focused = this;
+      farb.linkTo(function (color) { callback(input, color, false) });
+      farb.setColor(this.value);
+      $(focused).keyup(farb.updateValue).keyup(resetScheme)
+        .parent().addClass('item-selected');
+    }
+
+    // Initialize color fields
+    $('#image_captcha_color_items input.form-text', form).each(function () {
+      // Link to color picker temporarily to initialize.
+      farb.linkTo(function () {}).setColor('#000').linkTo(this);
+      inputs.push(this);
+    }).focus(focus);
+
+    // Focus first color
+    focus.call(inputs[0]);
+
+  });
+}
Index: image_captcha/image_captcha.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/captcha/image_captcha/image_captcha.module,v
retrieving revision 1.1.4.25
diff -u -u -p -r1.1.4.25 image_captcha.module
--- image_captcha/image_captcha.module	27 Nov 2007 23:47:02 -0000	1.1.4.25
+++ image_captcha/image_captcha.module	3 Dec 2007 09:02:48 -0000
@@ -52,7 +52,6 @@ function image_captcha_menu($may_cache) 
   return $items;
 }
 
-
 /*
  * Implementation of hook_requirements()
  * @todo these checks should be for the install phase,
@@ -63,7 +62,7 @@ function image_captcha_requirements($pha
   $requirements = array();
   $t = get_t();
   if ($phase == 'runtime') {
-   if (function_exists('imagegd2')) {
+    if (function_exists('imagegd2')) {
       $gd_info = gd_info();
       if (!$gd_info['FreeType Support']) {
         $requirements['image_captcha_ft'] = array(
@@ -86,7 +85,6 @@ function image_captcha_requirements($pha
   return $requirements;
 }
 
-
 /**
  * Returns:
  *  - the path to the image CAPTCHA font or FALSE when an error occured
@@ -189,6 +187,54 @@ function image_captcha_settings_form() {
     ),
   );
 
+
+
+
+  // Color settings
+  $form['image_captcha_colors'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Colors'),
+    '#attributes' => array('id' => 'image_captcha_colors'),
+  );
+  // Add Farbtastic color picker
+  drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
+  drupal_add_js('misc/farbtastic/farbtastic.js');
+  drupal_add_js(drupal_get_path('module', 'image_captcha') .'/image_captcha.js');
+  drupal_add_css(drupal_get_path('module', 'image_captcha') .'/image_captcha.css', 'module', FALSE);
+
+  $color_schemes = array(
+    '#ffffff,#000000' => t('Black on white'),
+    '#000000,#ffffff' => t('White on black'),
+    '#ffffff,#ff0000' => t('Red on white'),
+    '' => t('Custom'),
+  );
+  $form['image_captcha_colors']['image_captcha_color_scheme'] = array(
+    '#type' => 'select',
+    '#title' => t('Color scheme'),
+    '#options' => $color_schemes,
+    '#default_value' => '#000000,#ffffff',
+  );
+  $form['image_captcha_colors']['image_captcha_color_items'] = array(
+    '#type' => 'markup',
+    '#prefix' => '<div id="image_captcha_color_items">',
+    '#suffix' => '</div>',
+  );
+  $form['image_captcha_colors']['image_captcha_color_items']['image_captcha_color_background'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Background color'),
+    '#default_value' => variable_get('image_captcha_color_background', '#ffffff'),
+    '#size' => 8,
+    '#maxlength' => 7,
+  );
+  $form['image_captcha_colors']['image_captcha_color_items']['image_captcha_color_foreground'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Foreground color'),
+    '#default_value' => variable_get('image_captcha_color_foreground', '#000000'),
+    '#size' => 8,
+    '#maxlength' => 7,
+  );
+
+
   // distortion and noise settings
   $form['image_captcha_distortion_and_noise'] = array(
     '#type' => 'fieldset',
@@ -260,10 +306,8 @@ function image_captcha_settings_form_pre
   if ($form['image_captcha_font_settings']['image_captcha_font']['#default_value'] == 'BUILTIN') {
     drupal_set_message(t('The usage of the built-in bitmap font it is not recommended because of its small size and missing UTF-8 support.'), 'warning');
   }
-
 }
 
-
 /**
  * Validation function for image_captcha configuration form
  */
