_______________-=Team ColdFusion=-_______________
#2 DPAD - #2 OGR27 - #2 F@H - #3 R@H - #5 RC5 - #6 SoB - #10 WCG
||| #1 ECCp109 - #1 ECC2-109 - #1 OGR24 - #1 D2OL P1|||
Verwijderd
Overigens:
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
| <? // NOTES: // for color reference check this this URL: http://home.i1.net/~dwolfe/hexmixer/000000.shtml; // // // ------------------------------------------------------------------------ // alternate_2colors // ------------------------------------------------------------------------ // Alternating colours with two colours // * example 1 // <table cellpadding=0 cellspacing=0 border=0 width=100%> /* <?php // include('html.php'); html.php contains our function // $t = 0; // while($t < 10) // { // echo '<TR BGCOLOR="' . $cl = alternate_2colors('#EEEEEE', '#FFFFFF', $t++). '"><td>'. $t . "</td></tr>\n"; // } // ?> // <table> */ // * example 2 // $nb += 1; // $couleur = alternate_2colors('#EEEEEE', '#FFFFFF', $nb); // echo'<TD BGCOLOR="'.$couleur.'"align=middle vAlign=center width=30%><SPAN class=small>'. $Ttl . '</SPAN></TD>'; // echo'<TD BGCOLOR="'.$couleur.'"align=middle vAlign=center width=30%><SPAN class=small>'. $Alb . '</SPAN></TD>'; // echo'<TD BGCOLOR="'.$couleur.'"align=middle vAlign=center width=30%><SPAN class=small>'. $Art . '</SPAN></TD>'; // echo'<TD BGCOLOR="'.$couleur.'"align=middle vAlign=center width=9%><SPAN class=small>'. $Time . '</SPAN></TD>'; // function alternate_2colors($color_1, $color_2, $cpt) { $couleur = ($cpt % 2) ? $color_1 : $color_2; return $couleur; } // ------------------------------------------------------------------------ // alternate_xcolors // ------------------------------------------------------------------------ // Alternating colors with unlimited colors // * $colors Has to be an array // * $t is an incremented interger // * $z iz the maximum value that $t can take // // * example // <table cellpadding=0 cellspacing=0 border=0 width=100%> /* <? php // include('html.php'); html.php contains our function // $colors = array(); // $colors[] = "#EDEDED"; // $colors[] = "#CCCCCC"; // $colors[] = "#FFFFFF"; // $colors[] = "#FFFFDF"; // // $t = 0; // while($t < 10) // { // echo '<TR BGCOLOR="' . $cl = alternate_Xcolors($colors,$t++,$t). '"><td>'. $t . "</td></tr>\n"; // } // ?> // <table> */ function alternate_Xcolors($colors, $t, $z) { $zb = floor($z/sizeof($colors)); $y = $z -($zb * sizeof($colors)); while ( $x < $zb ) { foreach($colors as $col) { $colr[] = $col; } $x++; } for ($i = 0; $i <= $y-1; $i++) { $colr[] = $colors[$i]; } return $colr[$t]; } // ------------------------------------------------------------------------ // Gradient // ------------------------------------------------------------------------ // create a gradient of colors from two colors // * $coldeb is the first color of the gradient in hex. // * $colfin is the last color of the gradient in hex, // this color will be ajasted for mathmatical reasons. // * $n is the size of the array returned by our function, // for example number of rows in a table. // // * example /* <? php // include('html.php'); html.php contains our function // $coldeb = '99FF99'; // $colfin = 'CCFFFF'; // $n = 79; // echo '<table cellpadding=0 cellspacing=0 border=0 width=100%>'; // foreach (Gradient($coldeb, $colfin, $n) as $gr) // { // echo '<tr bgcolor="#' . $gr . '"><td>col</td><td>col2</td></tr>'; // } // echo '</table>'; // ?> */ // calculate the RBG in decimal for an hex color function SeparateRBG($col) { $Color[R]= hexdec(substr($col, 0, 2 )); $Color[B] = hexdec(substr($col, 2, 2)); $Color[G] = hexdec(substr($col, -2)); return $Color ; } // return $GradientColor an array that contien the final gradient function Gradient($coldeb, $colfin, $n) { $Color[deb] = SeparateRBG($coldeb); $Color[fin] = SeparateRBG($colfin); $rbg = array('R', 'B', 'G'); // calculate the red, the bleu, and the green gradient foreach ($rbg as $RBG) { $Color[enc][$RBG] = floor( (($Color[fin][$RBG]) - ($Color[deb][$RBG])) / $n ); for ($x = 0 ; $x < $n ; $x++) { $Color[gradient][$RBG][$x] = dechex($Color[deb][$RBG] + ($Color[enc][$RBG] * $x)); if (strlen(strval($Color[gradient][$RBG][$x])) < 2) { $Color[gradient][$RBG][$x] = '0' . $Color[gradient][$RBG][$x]; } } } // build the final gradient array for ($i = 0 ; $i < $n ; $i++) { $GradientColor[] = $Color[gradient][R][$i] . $Color[gradient][B][$i] . $Color[gradient][G][$i]; } return $GradientColor; } // ------------------------------------------------------------------------ // Shade // ------------------------------------------------------------------------ // create a shade of colors from two colors // * $coldeb is the first color of the gradient in hex. // * $colfin is the last color of the gradient in hex, // this color will be ajasted for mathmatical reasons. // * $N is the size of the array returned by our function, // for example number of rows in a table. // // * example /* <? php // include('html.php'); html.php contains our function, it has to contien SeparateRBG($col) also // $coldeb = '99FF99'; // $colfin = 'CCFFFF'; // $n = 79; // echo '<table cellpadding=0 cellspacing=0 border=0 width=100%>'; // foreach (Shade($coldeb, $colfin, $n) as $gr) // { // echo '<tr bgcolor="#' . $gr . '"><td>col</td><td>col2</td></tr>'; // } // echo '</table>'; // ?> */ function Shade($coldeb, $colfin, $N) { $n = floor($N/2); $Color[deb] = SeparateRBG($coldeb); $Color[fin] = SeparateRBG($colfin); $rbg = array('R', 'B', 'G'); // calculate the red, the bleu, and the green gradient foreach ($rbg as $RBG) { $Color[enc][$RBG] = floor( (($Color[fin][$RBG]) - ($Color[deb][$RBG])) / $n ); for ($x = 0 ; $x <= $n ; $x++) { $Shade[$RBG][$x] = dechex($Color[deb][$RBG] + ($Color[enc][$RBG] * $x)); if (strlen(strval($Shade[$RBG][$x])) < 2) { $Shade[$RBG][$x] = '0' . $Shade[$RBG][$x]; } } } // build the final gradient array for ($i = 0 ; $i <= $n ; $i++) { // $ShadeColor is the array that contien the final garadient $ShadeColor[] = $Shade[R][$i] . $Shade[B][$i] . $Shade[G][$i]; } $ShadeColorRev = Array_reverse($ShadeColor); array_pop ($ShadeColor); $shade = Array_merge($ShadeColor ,$ShadeColorRev ); unset($ShadeColorRev); unset($ShadeColor); return $shade; } ?> |