그냥 편하게 이용해볼까 하는 생각에... 알아서들 이용해보세요~ ^^
<?
function gcolor ($color1, $color2, $count) {
$c1_r = hexdec(substr($color1,0,2)); // 색1 Red
$c1_g = hexdec(substr($color1,2,2)); // 색1 Green
$c1_b = hexdec(substr($color1,4,2)); // 색1 Blue
$c2_r = hexdec(substr($color2,0,2)); // 색2 Red
$c2_g = hexdec(substr($color2,2,2)); // 색2 Green
$c2_b = hexdec(substr($color2,4,2)); // 색2 Blue
$cg1 = abs((int)(($c2_r-$c1_r)/$count)); // Red 증가치&감소치 구함
$cg2 = abs((int)(($c2_g-$c1_g)/$count)); // Green 증가치&감소치 구함
$cg3 = abs((int)(($c2_b-$c1_b)/$count)); // Blue 증가치&감소치 구함
for ($i=0;$i<$count;$i++) {
$gc_1 = ($c1_r>$c2_r) ? $c1_r-($cg1*$i) : $c1_r+($cg1*$i); // 색1값이 색2값보다 큰지 작은지 판단해 증가치&감소치 계산
$gc_2 = ($c1_g>$c2_g) ? $c1_g-($cg2*$i) : $c1_g+($cg2*$i); // 색1값이 색2값보다 큰지 작은지 판단해 증가치&감소치 계산
$gc_3 = ($c1_b>$c2_b) ? $c1_b-($cg3*$i) : $c1_b+($cg3*$i); // 색1값이 색2값보다 큰지 작은지 판단해 증가치&감소치 계산
$gcolor[$i] = sprintf("%02x%02x%02x",$gc_1,$gc_2,$gc_3); // 10진수를 16진수 형태로 변환해 저장
}
return $gcolor; // 배열값 반환
}
$memo_view = 12; // 한번에 보여줄 게시물 수
$color1 = "000066"; // 색1
$color2 = "1084d0"; // 색2
$gcolor = gcolor($color1, $color2, $memo_view); // 그라데이션 구하기
echo "<style>p,body,td { font-size:9pt; }</style>n";
echo "<table align='center' border='0' cellpadding='0' cellspacing='0' width='300'>n";
for ($i=0;$i<$memo_view;$i++) {
echo " <tr>n <td bgcolor='#$gcolor[$i]' align='center'><p><font color='white'>$gcolor[$i]</font></p></td>n </tr>n";
}
echo "</table>n";
?>
* 전설님에 의해서 게시물 이동되었습니다 (2004-05-30 17:07)
* 이동한 이유 :
* 원래의 위치 : 웹 공부 >> 웹 프로그래밍
* 이동후 위치 : 웹 공부 >>
* 전설님에 의해서 게시물 이동되었습니다 (2004-05-30 17:12)
* 이동한 이유 :
* 원래의 위치 : 웹 공부 >>
* 이동후 위치 : 웹 공부 >> 웹 프로그래밍