Random Themes for SquirrelMail
authorfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 20 Dec 2001 19:53:19 +0000 (19:53 +0000)
committerfidian <fidian@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 20 Dec 2001 19:53:19 +0000 (19:53 +0000)
by Jorey Bump

These themes generate random colors whenever a page is refreshed or a new one is
loaded.

** NOTE:  Question Reality wasn't added since it was 100% random and would
often produce unreadable results.  From the readme, it was listed as "For
demonstration purposes only!"  I hope Jorey doesn't mind. **

Spice of Life: This theme creates contrasting colors for easier readability. I
have also provided 2 variations, one that always provides a dark background and
one that always provides a light background (my personal favorite).

Greenhouse Effect, Kind of Blue, In the Pink, and Shades of Grey: As the titles
suggest, these themes favor a specific color.

Monostochastic: This creates a contrasting 2 color theme. There is only one
color for text, one for the background. Very spartan.

NOTES:

These themes will not interfere with the message highlighting feature provided
by SquirrelMail, but sometimes the results may be unpleasant.

I haven't tried it, but I assume that any colors specified in an external css
file will override the ones provided by any theme.

On a slightly technical note, this code will actually cause 2 themes to be
generated, one for each frame.

The SquirrelMail developers have not formally declared that certain elements of
the color array be used for text vs. background (although that would be nice!),
so I had to make educated guesses during development. I've noticed that
SquirrelMail borrows a background color from the right frame to use as a text
color in the left, to display parent folder names. This sometimes causes
the folder names to be barely legible. Since my code loads a different theme in
each frame, this situation cannot occur. It's something to keep in mind when
you're designing themes, however. Here's a fix, if you find this to be as
annoying as I do:

Change line 172 (in 1.2.0-rc2) of src/left_main.php from:

 $line .= "<FONT COLOR=\"$color[10]\">";

to:

 $line .= "<b><FONT COLOR=\"$color[6]\">";

Hopefully, this will be changed in future versions, and the color array will be
standardized for text and background colors.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1874 7612ce4b-ef26-0410-bec9-ea0150e637f0

themes/greenhouse_effect.php [new file with mode: 0755]
themes/in_the_pink.php [new file with mode: 0755]
themes/kind_of_blue.php [new file with mode: 0755]
themes/monostochastic.php [new file with mode: 0755]
themes/shades_of_grey.php [new file with mode: 0755]
themes/spice_of_life.php [new file with mode: 0755]
themes/spice_of_life_dark.php [new file with mode: 0755]
themes/spice_of_life_lite.php [new file with mode: 0755]

diff --git a/themes/greenhouse_effect.php b/themes/greenhouse_effect.php
new file mode 100755 (executable)
index 0000000..2b52c0d
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Greenhouse Effect"
+
+       This theme generates random colors, featuring a light greenish background with dark text.
+
+   **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $g = mt_rand(248,255);
+               $r = mt_rand(110,248);
+               $b = mt_rand(109,$r);
+       } else {
+               /** text **/
+               $cmin = 0;
+               $cmax = 96;
+
+               /** generate random color **/
+               $b = mt_rand($cmin,$cmax);
+               $g = mt_rand($cmin,$cmax);
+               $r = mt_rand($cmin,$cmax);
+       }
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/in_the_pink.php b/themes/in_the_pink.php
new file mode 100755 (executable)
index 0000000..395419d
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "In the Pink"
+
+       This theme generates random colors, featuring a reddish background with dark text.
+
+   **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $r = mt_rand(248,255);
+               $b = mt_rand(140,255);
+               $g = mt_rand(128,$b);
+       } else {
+               /** text **/
+               $b = mt_rand(2,128);
+               $r = mt_rand(1,$b);
+               $g = mt_rand(0,$r);
+       }
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/kind_of_blue.php b/themes/kind_of_blue.php
new file mode 100755 (executable)
index 0000000..74da17b
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Kind of Blue"
+
+       This theme generates random colors, featuring a light bluish background with dark text.
+
+   **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $b = mt_rand(248,255);
+               $g = mt_rand(180,255);
+               $r = mt_rand(178,$g);
+       } else {
+               /** text **/
+               $cmin = 0;
+               $cmax = 128;
+
+               /** generate random color **/
+               $b = mt_rand($cmin,$cmax);
+               $g = mt_rand($cmin,$cmax);
+               $r = mt_rand($cmin,$cmax);
+       }
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+   
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/monostochastic.php b/themes/monostochastic.php
new file mode 100755 (executable)
index 0000000..f662f39
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Monostochastic"
+
+       Generates random two-color frames, featuring either a dark or light background.
+       
+    **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   /** light(1) or dark(0) background toggle **/
+   $bg = mt_rand(0,1);
+   /** range delimiter **/
+   $bgrd = $bg * 128;
+
+   /** background **/
+   $cmin_b = 0 + $bgrd;
+   $cmax_b = 127 + $bgrd;
+
+   /** generate random color **/
+   $rb = mt_rand($cmin_b,$cmax_b);
+   $gb = mt_rand($cmin_b,$cmax_b);
+   $bb = mt_rand($cmin_b,$cmax_b);
+
+   /** text **/
+   $cmin_t = 128 - $bgrd;
+   $cmax_t = 255 - $bgrd;
+
+   /** generate random color **/
+   $rt = mt_rand($cmin_t,$cmax_t);
+   $gt = mt_rand($cmin_t,$cmax_t);
+   $bt = mt_rand($cmin_t,$cmax_t);
+
+   /** set array element as hex string with hashmark (for HTML output) **/
+   for ($i = 0; $i <= 14; $i++) {
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               $color[$i] = sprintf("#%02X%02X%02X",$rb,$gb,$bb);
+       } else {
+               $color[$i] = sprintf("#%02X%02X%02X",$rt,$gt,$bt);
+       }
+   }
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/shades_of_grey.php b/themes/shades_of_grey.php
new file mode 100755 (executable)
index 0000000..81caa86
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Shades of Grey"
+
+       This theme generates random colors, featuring a light greyish background with dark text.
+
+   **/
+
+   /** seed the random number generator **/
+   mt_srand ((double) microtime() * 1000000);
+
+   for ($i = 0; $i <= 14; $i++) {
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $r = mt_rand(176,255);
+               $g = $r;
+               $b = $r;
+       } else {
+               /** text **/
+               $cmin = 0;
+               $cmax = 127;
+
+               /** generate random color **/
+               $r = mt_rand($cmin,$cmax);
+               $g = mt_rand($cmin,$cmax);
+               $b = mt_rand($cmin,$cmax);
+       }
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/spice_of_life.php b/themes/spice_of_life.php
new file mode 100755 (executable)
index 0000000..6e51916
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Spice of Life"
+
+       Generates random colors for each frame, featuring either a dark or light background.
+       
+    **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   /** light(1) or dark(0) background? **/
+   $bg = mt_rand(0,1);
+   /** range delimiter **/
+   $bgrd = $bg * 128;
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $cmin = 0 + $bgrd;
+               $cmax = 127 + $bgrd;
+       } else {
+               /** text **/
+               $cmin = 128 - $bgrd;
+               $cmax = 255 - $bgrd;
+       }
+
+       /** generate random color **/
+       $r = mt_rand($cmin,$cmax);
+       $g = mt_rand($cmin,$cmax);
+       $b = mt_rand($cmin,$cmax);
+
+       /** set array element as hex string with hashmark (for HTML output) **/
+       $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/spice_of_life_dark.php b/themes/spice_of_life_dark.php
new file mode 100755 (executable)
index 0000000..157ea98
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Spice of Life - Dark"
+
+       This theme generates random colors, featuring a dark background with light text.
+
+    **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $cmin = 0;
+               $cmax = 127;
+       } else {
+               /** text **/
+               $cmin = 128;
+               $cmax = 255;
+       }
+
+        /** generate random color **/
+        $r = mt_rand($cmin,$cmax);
+        $g = mt_rand($cmin,$cmax);
+        $b = mt_rand($cmin,$cmax);
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>
diff --git a/themes/spice_of_life_lite.php b/themes/spice_of_life_lite.php
new file mode 100755 (executable)
index 0000000..b6fc270
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+   /** Author:       Jorey Bump
+       Date:         October 20, 2001
+       Theme Name:   "Spice of Life - Lite"
+
+       This theme generates random colors, featuring a lite background with dark text.
+
+   **/
+
+   /** seed the random number generator **/
+   sq_mt_randomize();
+
+   for ($i = 0; $i <= 14; $i++) {
+       /** background/foreground toggle **/
+       if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
+               /** background **/
+               $cmin = 128;
+               $cmax = 255;
+       } else {
+               /** text **/
+               $cmin = 0;
+               $cmax = 127;
+       }
+
+        /** generate random color **/
+        $r = mt_rand($cmin,$cmax);
+        $g = mt_rand($cmin,$cmax);
+        $b = mt_rand($cmin,$cmax);
+
+        /** set array element as hex string with hashmark (for HTML output) **/
+        $color[$i] = sprintf("#%02X%02X%02X",$r,$g,$b);
+   }
+
+
+/** Reference from  http://www.squirrelmail.org/wiki/CreatingThemes
+
+    $color[0]   = '#xxxxxx';  // Title bar at the top of the page header
+    $color[1]   = '#xxxxxx';  // Not currently used
+    $color[2]   = '#xxxxxx';  // Error messages (usually red)
+    $color[3]   = '#xxxxxx';  // Left folder list background color
+    $color[4]   = '#xxxxxx';  // Normal background color
+    $color[5]   = '#xxxxxx';  // Header of the message index // (From, Date,Subject)
+    $color[6]   = '#xxxxxx';  // Normal text on the left folder list
+    $color[7]   = '#xxxxxx';  // Links in the right frame
+    $color[8]   = '#xxxxxx';  // Normal text (usually black)
+    $color[9]   = '#xxxxxx';  // Darker version of #0
+    $color[10]  = '#xxxxxx';  // Darker version of #9
+    $color[11]  = '#xxxxxx';  // Special folders color (INBOX, Trash, Sent)
+    $color[12]  = '#xxxxxx';  // Alternate color for message list // Alters between #4 and this one
+    $color[13]  = '#xxxxxx';  // Color for quoted text -- > 1 quote
+    $color[14]  = '#xxxxxx';  // Color for quoted text -- >> 2 or more
+
+**/
+
+?>