Generation of color gradient
authorMichaël Parienti (edelweiss) <mparienti@easter-eggs.com>
Fri, 12 Jun 2009 15:32:06 +0000 (17:32 +0200)
committerMichaël Parienti (edelweiss) <mparienti@easter-eggs.com>
Fri, 12 Jun 2009 15:32:06 +0000 (17:32 +0200)
conf/css.php
script/generate-main-css.php
src/le/bg-updown.png [deleted file]
src/le/bg.png [deleted file]
src/le/main-template.css

index f341279..fab5c2f 100644 (file)
@@ -4,6 +4,10 @@ $config_values = array(
                        'body-width' => '60%',
                        'body-min-width' => '400px',
                        'body-background-color' => 'white',
+                       'body-background-image' => array('file_name' => 'bg.png',
+                                                        'first_color' => '#c4c8dd',
+                                                        'second_color' => 'white',
+                                                        'height' => 500) ,
                        
                        /* header */
                        'header-height' => '110px',
@@ -11,5 +15,9 @@ $config_values = array(
 
                        /* #content */
                        'content-background-color' => '#c4c8dd',
+                       'content-background-image' => array('file_name' => 'bg-updown.png',
+                                                           'first_color' => 'white',
+                                                           'second_color' => '#c4c8dd',
+                                                           'height' => 500) ,
                        );
 ?>
\ No newline at end of file
index 0db5c26..6a5109a 100644 (file)
@@ -7,7 +7,23 @@ require( $project_dir . 'conf/css.php' );
 $main_css = file_get_contents( $project_dir . 'src/le/main-template.css');
 
 foreach ($config_values as $var => $val) {
-  $main_css = str_replace( '{' . $var . '}', $val, $main_css);
+  if (!is_array($val)) {
+
+    $main_css = str_replace( '{' . $var . '}', $val, $main_css);
+
+  } else {
+
+    $im = new Imagick();
+
+    $im->newPseudoImage( 40, $val['height'], 'gradient:' . $val['first_color'] . '-' . $val['second_color']);
+
+    $im->setImageFormat('png');
+
+    file_put_contents($project_dir . 'src/le/' . $val['file_name'], $im);
+
+    $main_css = str_replace( '{' . $var . '}', '/skins/le/' . $val['file_name'], $main_css);
+
+  }
 }
 
 $main_css;
diff --git a/src/le/bg-updown.png b/src/le/bg-updown.png
deleted file mode 100644 (file)
index 1c49424..0000000
Binary files a/src/le/bg-updown.png and /dev/null differ
diff --git a/src/le/bg.png b/src/le/bg.png
deleted file mode 100644 (file)
index ee25c96..0000000
Binary files a/src/le/bg.png and /dev/null differ
index d490a33..065f17c 100644 (file)
@@ -14,7 +14,7 @@ body {
     font-family: sans-serif;
     font-size: 0.85em;
 
-    background-image: url("/skins/le/bg.png");
+    background-image: url('{body-background-image}');
     background-repeat: repeat-x;
     background-color: {body-background-color};
 
@@ -57,7 +57,7 @@ body {
 }
 
 #content {
-    background-image: url("/skins/le/bg-updown.png");
+    background-image: url('{content-background-image}');
     background-repeat: repeat-x;
     background-color: {content-background-color};