projects
/
squirrelmail.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added netstyle theme by Gabriele Maidecchi. Patch #1041323.
[squirrelmail.git]
/
themes
/
darkness.php
diff --git
a/themes/darkness.php
b/themes/darkness.php
index d4a45fb4d68ba0c161ee4270e3e5415b33afc99d..a6e11c6a3233091aca5bb6a26b7ee22816bd107d 100755
(executable)
--- a/
themes/darkness.php
+++ b/
themes/darkness.php
@@
-1,12
+1,23
@@
<?php
<?php
- /** Author: Tyler Akins
- Theme Name: "Darkness"
+/**
+ * @author Tyler Akins
+ * Theme Name: 'Darkness'
+ * Like black?
+ * @package squirrelmail
+ * @subpackage themes
+ */
- Like black?
-
- **/
+/**
+ * Load up the usual suspects.. */
+require_once(SM_PATH . 'functions/strings.php');
- $TargetDistance = 16384;
+ // Note: The text distance is actually pre-squared
+ // Background range is from 24-64, all three colors are the same
+ // Text range is from 196 to 255
+ $BackgroundTargetDistance = 12;
+ $BackgroundAdjust = 1;
+ $TextTargetDistance = 65536;
+ $TextAdjust = 0.95;
function IsUnique($Distance, $r, $g, $b, $usedArray)
{
function IsUnique($Distance, $r, $g, $b, $usedArray)
{
@@
-26,18
+37,18
@@
function IsUnique($Distance, $r, $g, $b, $usedArray)
// Always tremble background
// This might make people go insane. Yes! *Victory dance!*
function Darkness_HeaderPlugin() {
// Always tremble background
// This might make people go insane. Yes! *Victory dance!*
function Darkness_HeaderPlugin() {
- global $PHP_SELF
, $Darkness_Transition
;
-
- if (substr($PHP_SELF, -18) ==
"/src/left_main.php"
) {
+ global $PHP_SELF;
+
+ if (substr($PHP_SELF, -18) ==
'/src/left_main.php'
) {
echo '<meta http-equiv="Page-Enter" content="' .
echo '<meta http-equiv="Page-Enter" content="' .
- 'blendTrans(Duration=2.0)">' . "\n";
+ 'blendTrans(Duration=2.0)"
/
>' . "\n";
}
}
-
-?><script language=
javascript
>
+
+?><script language=
"javascript"
>
darkness_color = 0;
darkness_dir = +1;
darkness_color = 0;
darkness_dir = +1;
-darkness_hex = new Array(
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
-
"A", "B", "C", "D", "E", "F"
);
+darkness_hex = new Array(
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+
'a', 'b', 'c', 'd', 'e', 'f'
);
function DarknessTremble() {
if (darkness_color >= 32 || darkness_color <= 0)
darkness_dir = - darkness_dir;
function DarknessTremble() {
if (darkness_color >= 32 || darkness_color <= 0)
darkness_dir = - darkness_dir;
@@
-47,12
+58,12
@@
function DarknessTremble() {
bigDigit = Math.floor(darkness_color / 16);
littleDigit = darkness_color - (bigDigit * 16);
Color = darkness_hex[bigDigit] + darkness_hex[littleDigit];
bigDigit = Math.floor(darkness_color / 16);
littleDigit = darkness_color - (bigDigit * 16);
Color = darkness_hex[bigDigit] + darkness_hex[littleDigit];
- document.bgColor=
"#"
+ Color + Color + Color;
- setTimeout(
"DarknessTremble()"
, 5000);
+ document.bgColor=
'#'
+ Color + Color + Color;
+ setTimeout(
'DarknessTremble()'
, 5000);
}
}
-setTimeout(
"DarknessTremble()"
, 10000);
+setTimeout(
'DarknessTremble()'
, 10000);
</script>
</script>
-<?
PHP
+<?
php
}
global $squirrelmail_plugin_hooks;
}
global $squirrelmail_plugin_hooks;
@@
-62,32
+73,35
@@
$squirrelmail_plugin_hooks['generic_header']['theme_darkness'] =
/** seed the random number generator **/
sq_mt_randomize();
/** seed the random number generator **/
sq_mt_randomize();
- $color[3] =
"#000000"
;
- $color[4] =
"#000000"
;
- $used = array(
array(0, 0, 0)
);
- $targetDistance = $TargetDistance;
+ $color[3] =
'#000000'
;
+ $color[4] =
'#000000'
;
+ $used = array(
0
);
+ $targetDistance = $
Background
TargetDistance;
$Left = array(0, 5, 9, 10, 12);
while (count($Left) > 0) {
// Some background colors
$Left = array(0, 5, 9, 10, 12);
while (count($Left) > 0) {
// Some background colors
- $r = mt_rand(32,64);
- $g = $r;
- $b = $r;
- if (IsUnique($targetDistance, $r, $g, $b, $used)) {
+ $r = mt_rand(24,64);
+ $unique = true;
+ foreach ($used as $col) {
+ if (abs($r - $col) < $targetDistance)
+ $unique = false;
+ }
+ if ($unique) {
$i = array_shift($Left);
$i = array_shift($Left);
- $color[$i] = sprintf(
"#%02X%02X%02X",$r,$g,$b
);
-
$used[] = array($r, $g, $b)
;
-
$targetDistance = $
TargetDistance;
+ $color[$i] = sprintf(
'#%02X%02X%02X',$r,$r, $r
);
+
$used[] = $r
;
+
$targetDistance = $Background
TargetDistance;
} else {
} else {
- $targetDistance
*= 0.9
;
+ $targetDistance
-= $BackgroundAdjust
;
}
}
}
}
-
+
// Set the error color to some shade of red
$r = mt_rand(196, 255);
$g = mt_rand(144, ($r * .8));
// Set the error color to some shade of red
$r = mt_rand(196, 255);
$g = mt_rand(144, ($r * .8));
- $color[2] = sprintf(
"#%02X%02X%02X"
, $r, $g, $g);
+ $color[2] = sprintf(
'#%02X%02X%02X'
, $r, $g, $g);
$used = array(array($r, $g, $g));
$used = array(array($r, $g, $g));
-
+
// Set normal text colors
$cmin = 196;
$cmax = 255;
// Set normal text colors
$cmin = 196;
$cmax = 255;
@@
-96,17
+110,17
@@
$squirrelmail_plugin_hooks['generic_header']['theme_darkness'] =
$r = mt_rand($cmin,$cmax);
$g = mt_rand($cmin,$cmax);
$b = mt_rand($cmin,$cmax);
$r = mt_rand($cmin,$cmax);
$g = mt_rand($cmin,$cmax);
$b = mt_rand($cmin,$cmax);
- $color[$i] = sprintf(
"#%02X%02X%02X"
,$r,$g,$b);
+ $color[$i] = sprintf(
'#%02X%02X%02X'
,$r,$g,$b);
$used[] = array($r, $g, $b);
}
$used[] = array($r, $g, $b);
}
-
+
$Left = array(1, 7, 11, 13, 14, 15);
$Left = array(1, 7, 11, 13, 14, 15);
- $targetDistance = $TargetDistance;
+ $targetDistance = $T
extT
argetDistance;
while (count($Left) > 0) {
// Text colors -- Try to keep the colors distinct
$cmin = 196;
$cmax = 255;
while (count($Left) > 0) {
// Text colors -- Try to keep the colors distinct
$cmin = 196;
$cmax = 255;
-
+
/** generate random color **/
$r = mt_rand($cmin,$cmax);
$g = mt_rand($cmin,$cmax);
/** generate random color **/
$r = mt_rand($cmin,$cmax);
$g = mt_rand($cmin,$cmax);
@@
-114,11
+128,11
@@
$squirrelmail_plugin_hooks['generic_header']['theme_darkness'] =
if (IsUnique($targetDistance, $r, $g, $b, $used)) {
$i = array_shift($Left);
if (IsUnique($targetDistance, $r, $g, $b, $used)) {
$i = array_shift($Left);
- $color[$i] = sprintf(
"#%02X%02X%02X"
,$r,$g,$b);
- $used[] = array($r, $g, $b);
-
$targetDistance = $
TargetDistance;
+ $color[$i] = sprintf(
'#%02X%02X%02X'
,$r,$g,$b);
+
$used[] = array($r, $g, $b);
+
$targetDistance = $Text
TargetDistance;
} else {
} else {
- $targetDistance *=
0.9
;
+ $targetDistance *=
$TextAdjust
;
}
}
}
}
@@
-138,9
+152,9
@@
b 9: Darker version of #0
b 10: Darker version of #9
f 11: Special folders color [Inbox, Trash, Sent]
b 12: Alternate color for message list [alters between 4 and this one]
b 10: Darker version of #9
f 11: Special folders color [Inbox, Trash, Sent]
b 12: Alternate color for message list [alters between 4 and this one]
-f 13: Color for single-quoted text (
"> text"
) when reading (default: #800000)
+f 13: Color for single-quoted text (
'> text'
) when reading (default: #800000)
f 14: Color for text with more than one quote (default: #FF0000)
**/
f 14: Color for text with more than one quote (default: #FF0000)
**/
-?>
+?>
\ No newline at end of file