Location: PHPKode > projects > phpBible > phpbible/admin/color_scheme.php
<?php

###
###
###    Copyright 2004, Danny Carlton. Permission is hereby granted to distribute 
###  copies of this software package as long as you do not charge for it, and the 
###  copyright notices remain intact. Permission is also granted to use the concepts 
###  in these scripts for other similar scripts, but you may not simply copy the scripts and claim them as your own.
###   
###

require("../config.php");
#$base_color='#008000';

$script_name_in='admin/admin.php';

$color_num=str_replace('#', '', $base_color);

$r=hexdec(substr($color_num, 0, 2));
$g=hexdec(substr($color_num, 2, 2));
$b=hexdec(substr($color_num, 4, 2));

$lum=($r+$g+$b)/3;

$rd=$r/2;
$gd=$g/2;
$bd=$b/2;

$rl=$r+((256-$r)/2);
$gl=$g+((256-$g)/2);
$bl=$b+((256-$b)/2);

$rvl=$rl+((256-$rl)/2);
$gvl=$gl+((256-$gl)/2);
$bvl=$bl+((256-$bl)/2);
#$rl=($rvl*1.1);
#$gl=($gvl*1.1);
#$bl=($bvl*1.1);
$rvl=$rvl+((256-$rvl)/2);
$gvl=$gvl+((256-$gvl)/2);
$bvl=$bvl+((256-$bvl)/2);

#$rvl=256-($rl/5);
#$gvl=256-($gl/5);
#$bvl=256-($bl/5);


$rd=dechex($rd);
$gd=dechex($gd);
$bd=dechex($bd);


$rl=dechex($rl);
$gl=dechex($gl);
$bl=dechex($bl);

$rvl=dechex($rvl);
$gvl=dechex($gvl);
$bvl=dechex($bvl);

if(strlen($rd)<2){$rd="0$rd";}
if(strlen($gd)<2){$gd="0$gd";}
if(strlen($bd)<2){$bd="0$bd";}

if(strlen($rl)<2){$rl="0$rl";}
if(strlen($gl)<2){$gl="0$gl";}
if(strlen($bl)<2){$bl="0$bl";}

if(strlen($rvl)<2){$rvl="0$rvl";}
if(strlen($gvl)<2){$gvl="0$gvl";}
if(strlen($bvl)<2){$bvl="0$bvl";}


$color_dark="#$rd$gd$bd";
$color_light="#$rl$gl$bl";
$color_vlight="#$rvl$gvl$bvl";
$color_num="#$color_num";


#echo "<table width=100><tr>
#      <td style=\"border: 1px solid $color_dark\" bgcolor=\"$color_dark\"> &nbsp;</td></tr><tr>
#      <td style=\"border: 1px solid $color_dark\" bgcolor=\"$base_color\"> &nbsp;</td></tr><tr>
#      <td style=\"border: 1px solid $color_dark\" bgcolor=\"$color_light\"> &nbsp;</td></tr><tr>
#      <td style=\"border: 1px solid $color_dark\" bgcolor=\"$color_vlight\"> &nbsp;</td>
#    </tr>
#  </table>$lum";

$out_data="<?php
\$site_name='$site_name';
\$main_url='$main_url';
\$script_name='$script_name';
\$db_name='$db_name';
\$table_prefix='$table_prefix';
\$host='$host';
\$user='$user';
\$password='$password';
\$page_very_dark='$color_dark';
\$page_dark='$color_num';
\$page_medium='$color_light';
\$page_light='$color_vlight';
\$results_side='$results_side';
\$domain='$domain';
\$path='$path';
?>";

$fp = fopen("../config.php", "w");
fwrite ($fp, $out_data);
fclose ($fp);

$out_data=".def         { color: $color_num; text-decoration: none; cursor: hand }
.def:hover   { color: #FF0000; text-decoration: none; cursor: hand }
.selected    { background-color: $color_vlight; border-style: outset; border-width: 0 }
a            { color: $color_num; text-decoration: none }
a:hover      { color: #FF0000; text-decoration: none }
.custom_input { background-color: $color_vlight; color: $color_num; border: 1 solid $color_num }
.custom_button { background-color: $color_light; color: $color_num; font-family: Verdana; font-size: 
               10pt; font-weight: bold; border-style: outset; border-width: 1 }
.def_title         { color: $color_vlight; text-decoration: none; cursor: hand }
.def_title:hover   { color: #FF0000; text-decoration: none; cursor: hand }
.dark        { color: $color_vlight; background-color: $color_num;}
.light       { color: $color_num; background-color: $color_vlight;}
.medium      { color: $color_vlight; background-color: $color_light;}
body         { scrollbar-face-color: $color_light;
               scrollbar-highlight-color: $color_vlight;
               scrollbar-shadow-color: $color_num;
               scrollbar-3dlight-color: $color_vlight;
               scrollbar-arrow-color:  $color_num;
               scrollbar-track-color: $color_vlight;
               scrollbar-darkshadow-color: $color_dark }";

$fp = fopen("../phpBible.css", "w");
fwrite ($fp, $out_data);
fclose ($fp);

  header("Location: $domain/$path$script_name_in"); /* Redirect browser */
  exit; 

?>
Return current item: phpBible