Index: colorbox.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/colorbox.admin.inc,v
retrieving revision 1.16.2.4
diff -u -p -r1.16.2.4 colorbox.admin.inc
--- colorbox.admin.inc	28 Oct 2010 18:52:41 -0000	1.16.2.4
+++ colorbox.admin.inc	21 Nov 2010 16:15:45 -0000
@@ -149,20 +149,24 @@ function colorbox_admin_settings() {
     '#collapsed' => TRUE
   );
   $colorbox_styles = array(
-    'default' => t('Default'),
-    'stockholmsyndrome' => t('Stockholm Syndrome'),
     $colorbox_path .'/example1' => t('Example 1'),
     $colorbox_path .'/example2' => t('Example 2'),
     $colorbox_path .'/example3' => t('Example 3'),
     $colorbox_path .'/example4' => t('Example 4'),
     $colorbox_path .'/example5' => t('Example 5'),
-    'none' => t('None'),
   );
+  $styles = colorbox_get_styles();
+  $styles_path = drupal_get_path('module', 'colorbox') .'/styles';
+  if ($styles) {
+    $colorbox_styles = array_merge($colorbox_styles, $styles);
+  }
+  $colorbox_styles = array_merge($colorbox_styles, array('none' => t('None')));
+
   $form['colorbox_custom_settings']['colorbox_style'] = array(
     '#type' => 'select',
     '#title' => t('Style'),
     '#options' => $colorbox_styles,
-    '#default_value' => variable_get('colorbox_style', 'default'),
+    '#default_value' => variable_get('colorbox_style', $styles_path .'/default'),
     '#description' => t('Select the style to use for the Colorbox. The example styles are the ones that come with the Colorbox plugin. Select "None" if you have added Colorbox styles to your theme.'),
   );
   $form['colorbox_custom_settings']['colorbox_custom_settings_activate'] = array(
@@ -356,3 +360,31 @@ function colorbox_admin_settings() {
   return system_settings_form($form);
 }
 
+/**
+ * Collects contributed styles if any.
+ */
+function colorbox_get_styles() {
+  $styles_path = drupal_get_path('module', 'colorbox') .'/styles';
+  $styles = array();
+  // Open a known directory, and proceed to read its contents
+  if (is_dir($styles_path)) {
+    $dirscan = file_scan_directory($styles_path, ".*", array('.', '..', 'CVS'), 0, FALSE);
+    foreach ($dirscan AS $style) {
+      if (is_dir($styles_path . '/' . $style->basename) && file_exists($styles_path .'/'. $style->basename .'/'. 'colorbox.css')) {
+        $dir = $style->basename;
+        $name = $dir;
+        if (file_exists($styles_path .'/'. $dir .'/'. 'name.txt')) {
+          $file = file($styles_path .'/'. $dir .'/'. 'name.txt');
+          if (! empty($file[0])) {
+            $name = trim($file[0]);
+          }
+        }
+        $styles[$styles_path . '/' . $dir] = $name;
+      }
+    }
+  }
+  if (count($styles)) {
+    return $styles;
+  }
+  return FALSE;
+}
Index: colorbox.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/colorbox/colorbox.module,v
retrieving revision 1.19.2.10
diff -u -p -r1.19.2.10 colorbox.module
--- colorbox.module	10 Nov 2010 06:51:37 -0000	1.19.2.10
+++ colorbox.module	21 Nov 2010 16:15:45 -0000
@@ -217,7 +217,8 @@ function _colorbox_doheader() {
   }
 
   $path = drupal_get_path('module', 'colorbox');
-  $style = variable_get('colorbox_style', 'default');
+  $styles_path = $path .'/styles';
+  $style = variable_get('colorbox_style', $styles_path .'/default');
 
   // Give other modules the possibility to override Colorbox settings and style.
   $data = &$js_settings;
@@ -254,16 +255,11 @@ function _colorbox_doheader() {
   switch ($style) {
     case 'none':
       break;
-    case 'default':
-      drupal_add_css($path .'/styles/default/colorbox_default_style.css');
-      drupal_add_js($path .'/styles/default/colorbox_default_style.js');
-      break;
-    case 'stockholmsyndrome':
-      drupal_add_css($path .'/styles/stockholmsyndrome/colorbox_stockholmsyndrome.css');
-      drupal_add_js($path .'/styles/stockholmsyndrome/colorbox_stockholmsyndrome.js');
-      break;
     default:
       drupal_add_css($style .'/colorbox.css');
+      if (file_exists($style .'/colorbox_style.js')) {
+        drupal_add_js($style .'/colorbox_style.js');
+      }
   }
 
   if (variable_get('colorbox_load', 0)) {
