--- color.old.module	2007-10-02 17:32:14.914774300 +0200
+++ color.module	2007-10-02 16:59:54.274000000 +0200
@@ -46,12 +46,18 @@ function color_form_alter(&$form, $form_
  * Callback for the theme to alter the resources used.
  */
 function _color_page_alter(&$vars) {
-  global $theme_key;
+  global $language, $theme_key;
 
   // Override stylesheet
-  $path = variable_get('color_'. $theme_key .'_stylesheet', NULL);
-  if ($path) {
-    $vars['css']['all']['theme'][$path] = TRUE;
+  $path_ltr = variable_get('color_'. $theme_key .'_stylesheet', NULL);
+  $path_rtl = variable_get('color_'. $theme_key .'_stylesheet_rtl', NULL);
+  if ($path_ltr || $path_rtl) {
+    if ($path_ltr) {
+      $vars['css']['all']['theme'][$path_ltr] = TRUE;
+    }
+    if ($path_rtl && defined('LANGUAGE_RTL') && $language->direction == LANGUAGE_RTL) {
+      $vars['css']['all']['theme'][$path_rtl] = TRUE;
+    }
     $vars['styles'] = drupal_get_css($vars['css']);
   }
 
@@ -230,6 +236,7 @@ function color_scheme_form_submit($form,
     || $form_state['values']['op'] == t('Reset to defaults')) {
     variable_del('color_'. $theme .'_palette');
     variable_del('color_'. $theme .'_stylesheet');
+    variable_del('color_'. $theme .'_stylesheet_rtl');
     variable_del('color_'. $theme .'_logo');
     variable_del('color_'. $theme .'_files');
     variable_del('color_'. $theme .'_screenshot');
@@ -247,11 +254,13 @@ function color_scheme_form_submit($form,
   $paths['id'] = $id;
   $paths['source'] = drupal_get_path('theme', $theme) .'/';
   $paths['stylesheet'] = $paths['target'] .'style.css';
+  $paths['stylesheet_rtl'] = $paths['target'] .'style-rtl.css';
   $paths['files'] = $paths['map'] = array();
 
   // Save palette and stylesheet location
   variable_set('color_'. $theme .'_palette', $palette);
   variable_set('color_'. $theme .'_stylesheet', $paths['stylesheet']);
+  variable_set('color_'. $theme .'_stylesheet_rtl', $paths['stylesheet_rtl']);
   variable_set('color_'. $theme .'_logo', $paths['target'] .'logo.png');
 
   // Copy over neutral images
@@ -271,6 +280,11 @@ function color_scheme_form_submit($form,
   $style = _color_rewrite_stylesheet($theme, $info, $paths, $palette, $style);
   _color_save_stylesheet($paths['target'] .'style.css', $style, $paths);
 
+  // Rewrite RTL stylesheet
+  $style = _color_rewrite_load_stylesheet($paths['source'] .'style-rtl.css');
+  $style = _color_rewrite_stylesheet($theme, $info, $paths, $palette, $style);
+  _color_save_stylesheet($paths['target'] .'style-rtl.css', $style, $paths);
+
   // Maintain list of files
   variable_set('color_'. $theme .'_files', $paths['files']);
 }
