|
|
|
|
|
Create a lighter shade of a hex color:
<?
function hexLighter($hex,$factor = 30)
{
$new_hex = '';
$base['R'] = hexdec($hex{0}.$hex{1});
$base['G'] = hexdec($hex{2}.$hex{3});
$base['B'] = hexdec($hex{4}.$hex{5});
foreach ($base as $k => $v)
{
$amount = 255 - $v;
$amount = $amount / 100;
$amount = round($amount * $factor);
$new_decimal = $v + $amount;
$new_hex_component = dechex($new_decimal);
if(strlen($new_hex_component) < 2)
{ $new_hex_component = "0".$new_hex_component; }
$new_hex .= $new_hex_component;
}
return $new_hex;
}
?>
Example, making a new colour 50% lighter than the first:
<?
$myCol = "FFCC99";
$newCol = hexLighter($myCol, 50);
?> |
|
| Color - making a hex color darker Categories : PHP, Colors | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Upload any fixed type of files, control file type through javascript and encrypt filename using php so file not get overwrite Categories : PHP, Java Script, Functions, PHP References, Form Processing | | | A class for sending email; it has support for To:, Cc:, Bcc: and Reply-To:
headers. It requires that you have sendmail installed. Categories : Email, PHP Classes, PHP | | | basename -- Returns filename component of path Categories : PHP, PHP Functions, Filesystem | | | columned txt file to array()? Categories : Arrays, Strings, Regexps, PHP | | | GroupIT Engine v1.00rc1
Categories : PHP, Content Management, MySQL, Databases | | | Three Cool Classes and One Trick Categories : PHP, PHP Classes, Graphics, Email | | | How to force the user to download a file instead of opening it up in an
controlled environment within the browser (i.e. MS Word/Adobe Acrobat) Categories : Browsers, PHP, HTTP | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Print out array key => value in colored HTML Categories : PHP, Arrays, HTML and PHP | | | Simple conversion functions to change MySQL dates to arrays, arrays to MySQL dates.
Categories : PHP, Arrays, Date Time, Databases, MySQL | | | Timer - a class that uses microtime() to provide easy calculation of elapsed times Categories : Algorithms, PHP, PHP Classes | | | Forcing a proxy to not cache a document Categories : HTTP, PHP | | | Email a user with out exposing email address Categories : PHP, Databases, MySQL, Email | |
| |
| |
|