952ea41c19a68abe1233b8085b0ea434e57eebd7
6 * Date: October 20, 2001
7 * Comment: Generates random two-color frames, featuring either
8 * a dark or light background.
11 * @copyright © 2000-2007 The SquirrelMail Project Team
12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @package squirrelmail
18 /** Prevent direct script loading */
19 if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__
) {
23 /** load sq_mt_randomize() */
24 include_once(SM_PATH
. 'functions/strings.php');
26 /** seed the random number generator */
29 /** light(1) or dark(0) background toggle **/
32 /** range delimiter **/
37 $cmax_b = 127 +
$bgrd;
39 /** generate random color **/
40 $rb = mt_rand($cmin_b,$cmax_b);
41 $gb = mt_rand($cmin_b,$cmax_b);
42 $bb = mt_rand($cmin_b,$cmax_b);
45 $cmin_t = 128 - $bgrd;
46 $cmax_t = 255 - $bgrd;
48 /** generate random color **/
49 $rt = mt_rand($cmin_t,$cmax_t);
50 $gt = mt_rand($cmin_t,$cmax_t);
51 $bt = mt_rand($cmin_t,$cmax_t);
53 /** set array element as hex string with hashmark (for HTML output) **/
54 for ($i = 0; $i <= 15; $i++
) {
55 if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
56 $color[$i] = sprintf('#%02X%02X%02X',$rb,$gb,$bb);
58 $color[$i] = sprintf('#%02X%02X%02X',$rt,$gt,$bt);