Since multiple select and checkbox widgets may not appear in the post, make sure...
[squirrelmail.git] / themes / spice_of_life.php
... / ...
CommitLineData
1<?php
2
3/**
4 * Name: Spice of Life
5 * Date: October 20, 2001
6 * Comment Generates random colors for each frame,
7 * featuring either a dark or light background.
8 *
9 * @author Jorey Bump
10 * @copyright &copy; 2000-2007 The SquirrelMail Project Team
11 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
12 * @version $Id$
13 * @package squirrelmail
14 * @subpackage themes
15 */
16
17/** Prevent direct script loading */
18if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) {
19 die();
20}
21
22/** load sq_mt_randomize() */
23include_once(SM_PATH . 'functions/strings.php');
24
25/** seed the random number generator **/
26sq_mt_randomize();
27
28/** light(1) or dark(0) background? **/
29$bg = mt_rand(0,1);
30
31/** range delimiter **/
32$bgrd = $bg * 128;
33
34for ($i = 0; $i <= 16; $i++) {
35 /** background/foreground toggle **/
36 if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12 or $i == 16) {
37 /** background **/
38 $cmin = 0 + $bgrd;
39 $cmax = 127 + $bgrd;
40 } else {
41 /** text **/
42 $cmin = 128 - $bgrd;
43 $cmax = 255 - $bgrd;
44 }
45
46 /** generate random color **/
47 $r = mt_rand($cmin,$cmax);
48 $g = mt_rand($cmin,$cmax);
49 $b = mt_rand($cmin,$cmax);
50
51 /** set array element as hex string with hashmark (for HTML output) **/
52 $color[$i] = sprintf('#%02X%02X%02X',$r,$g,$b);
53}