Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / color / color.module
index b6ffa7c79e80d5498a979f1e49f6f7595c481be0..9ca7870a5bac0972c4920cbc9e49ecd13526a2ae 100644 (file)
@@ -5,6 +5,7 @@
  * Allows users to change the color scheme of themes.
  */
 
+use Drupal\Component\Utility\Color;
 use Drupal\Component\Utility\Unicode;
 use Drupal\Core\Asset\CssOptimizer;
 use Drupal\Component\Utility\Bytes;
@@ -513,7 +514,8 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
   // Prepare color conversion table.
   $conversion = $palette;
   foreach ($conversion as $k => $v) {
-    $conversion[$k] = Unicode::strtolower($v);
+    $v = Unicode::strtolower($v);
+    $conversion[$k] = Color::normalizeHexLength($v);
   }
   $default = color_get_palette($theme, TRUE);
 
@@ -533,6 +535,7 @@ function _color_rewrite_stylesheet($theme, &$info, &$paths, $palette, $style) {
   foreach ($style as $chunk) {
     if ($is_color) {
       $chunk = Unicode::strtolower($chunk);
+      $chunk = Color::normalizeHexLength($chunk);
       // Check if this is one of the colors in the default palette.
       if ($key = array_search($chunk, $default)) {
         $chunk = $conversion[$key];
@@ -635,7 +638,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) {
   foreach ($info['slices'] as $file => $coord) {
     list($x, $y, $width, $height) = $coord;
     $base = drupal_basename($file);
-    $image = drupal_realpath($paths['target'] . $base);
+    $image = \Drupal::service('file_system')->realpath($paths['target'] . $base);
 
     // Cut out slice.
     if ($file == 'screenshot.png') {