PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1_4_7/squirrelmail/themes/monostochastic.php

#
PHP | 76 lines | 22 code | 11 blank | 43 comment | 10 complexity | 2dc49de9419be471e07d9a714251bd05 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. <?php
  2. /**
  3. * monostochastic.php
  4. * Name: Monostochastic
  5. * Date: October 20, 2001
  6. * Comment: Generates random two-color frames, featuring either
  7. * a dark or light background.
  8. *
  9. * @author Jorey Bump
  10. * @copyright &copy; 2000-2006 The SquirrelMail Project Team
  11. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12. * @version $Id: monostochastic.php 10633 2006-02-03 22:27:56Z jervfors $
  13. * @package squirrelmail
  14. * @subpackage themes
  15. */
  16. /** seed the random number generator */
  17. sq_mt_randomize();
  18. /** light(1) or dark(0) background toggle **/
  19. $bg = mt_rand(0,1);
  20. /** range delimiter **/
  21. $bgrd = $bg * 128;
  22. /** background **/
  23. $cmin_b = 0 + $bgrd;
  24. $cmax_b = 127 + $bgrd;
  25. /** generate random color **/
  26. $rb = mt_rand($cmin_b,$cmax_b);
  27. $gb = mt_rand($cmin_b,$cmax_b);
  28. $bb = mt_rand($cmin_b,$cmax_b);
  29. /** text **/
  30. $cmin_t = 128 - $bgrd;
  31. $cmax_t = 255 - $bgrd;
  32. /** generate random color **/
  33. $rt = mt_rand($cmin_t,$cmax_t);
  34. $gt = mt_rand($cmin_t,$cmax_t);
  35. $bt = mt_rand($cmin_t,$cmax_t);
  36. /** set array element as hex string with hashmark (for HTML output) **/
  37. for ($i = 0; $i <= 15; $i++) {
  38. if ($i == 0 or $i == 3 or $i == 4 or $i == 5 or $i == 9 or $i == 10 or $i == 12) {
  39. $color[$i] = sprintf('#%02X%02X%02X',$rb,$gb,$bb);
  40. } else {
  41. $color[$i] = sprintf('#%02X%02X%02X',$rt,$gt,$bt);
  42. }
  43. }
  44. /* Reference from http://www.squirrelmail.org/wiki/CreatingThemes
  45. $color[0] = '#xxxxxx'; // Title bar at the top of the page header
  46. $color[1] = '#xxxxxx'; // Not currently used
  47. $color[2] = '#xxxxxx'; // Error messages (usually red)
  48. $color[3] = '#xxxxxx'; // Left folder list background color
  49. $color[4] = '#xxxxxx'; // Normal background color
  50. $color[5] = '#xxxxxx'; // Header of the message index
  51. // (From, Date,Subject)
  52. $color[6] = '#xxxxxx'; // Normal text on the left folder list
  53. $color[7] = '#xxxxxx'; // Links in the right frame
  54. $color[8] = '#xxxxxx'; // Normal text (usually black)
  55. $color[9] = '#xxxxxx'; // Darker version of #0
  56. $color[10] = '#xxxxxx'; // Darker version of #9
  57. $color[11] = '#xxxxxx'; // Special folders color (INBOX, Trash, Sent)
  58. $color[12] = '#xxxxxx'; // Alternate color for message list
  59. // Alters between #4 and this one
  60. $color[13] = '#xxxxxx'; // Color for quoted text -- > 1 quote
  61. $color[14] = '#xxxxxx'; // Color for quoted text -- >> 2 or more
  62. */
  63. ?>