First attempt at converting $color themes to CSS stylesheets. Seems to work pretty...
[squirrelmail.git] / themes / monostochastic.php
CommitLineData
95b5b26d 1<?php
95b5b26d 2
ed430208 3/**
4 * monostochastic.php
c4309fbd 5 * Name: Monostochastic
c4309fbd 6 * Date: October 20, 2001
7 * Comment: Generates random two-color frames, featuring either
8 * a dark or light background.
ed430208 9 *
4b4abf93 10 * @author Jorey Bump
47ccfad4 11 * @copyright &copy; 2000-2006 The SquirrelMail Project Team
4b4abf93 12 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @version $Id$
c4309fbd 14 * @package squirrelmail
15 * @subpackage themes
ed430208 16 */
95b5b26d 17
2c34672a 18/** Prevent direct script loading */
19if ((isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) ||
20 (isset($HTTP_SERVER_SERVER['SCRIPT_FILENAME']) && $HTTP_SERVER_SERVER['SCRIPT_FILENAME'] == __FILE__) ) {
21 die();
22}
23
24/** load sq_mt_randomize() */
25include_once(SM_PATH . 'functions/strings.php');
26
c4309fbd 27/** seed the random number generator */
ed430208 28sq_mt_randomize();
95b5b26d 29
ed430208 30/** light(1) or dark(0) background toggle **/
31$bg = mt_rand(0,1);
eb548244 32
ed430208 33/** range delimiter **/
34$bgrd = $bg * 128;
95b5b26d 35
ed430208 36/** background **/
37$cmin_b = 0 + $bgrd;
38$cmax_b = 127 + $bgrd;
95b5b26d 39
ed430208 40/** generate random color **/
41$rb = mt_rand($cmin_b,$cmax_b);
42$gb = mt_rand($cmin_b,$cmax_b);
43$bb = mt_rand($cmin_b,$cmax_b);
95b5b26d 44
ed430208 45/** text **/
46$cmin_t = 128 - $bgrd;
47$cmax_t = 255 - $bgrd;
95b5b26d 48
ed430208 49/** generate random color **/
50$rt = mt_rand($cmin_t,$cmax_t);
51$gt = mt_rand($cmin_t,$cmax_t);
52$bt = mt_rand($cmin_t,$cmax_t);
95b5b26d 53
ed430208 54/** set array element as hex string with hashmark (for HTML output) **/
ecf5c1bd 55for ($i = 0; $i <= 15; $i++) {
ed430208 56 if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
1681f4d9 57 $color[$i] = sprintf('#%02X%02X%02X',$rb,$gb,$bb);
ed430208 58 } else {
1681f4d9 59 $color[$i] = sprintf('#%02X%02X%02X',$rt,$gt,$bt);
ed430208 60 }
61}