note 98849 added to faq
| From: | smoke dot gfxatgmaildotcom at osu1 dot php dot net | Date: | Sun, 11 Jul 2010 01:37:10 +0000 |
| Subject: | note 98849 added to faq | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170870@lists.php.net to get a copy of this message | ||
comment@cory:
Even though websafe colours are great, they often do not come close enough to the original colour.
I would like to offer the following as an alternative:
(example at http://testsrv.dk/colour/)
----> function takes hex colour (without #) as input <----
<?php
function webSafe($input)
{
$r = substr($input,0,1);
$g = substr($input,2,1);
$b = substr($input,4,1);
$output = $r.$r.$g.$g.$b.$b;
return $output;
}
echo webSafe('3D6181');
?>
//output would be: 336611
//please send me an email if you have questions or comments
----
Server IP: 83.137.20.135
Probable Submitter: 82.170.224.99
----
Manual Page -- http://www.php.net/manual/en/faq.php
Edit -- https://master.php.net/note/edit/98849
Del: integrated -- https://master.php.net/note/delete/98849/integrated
Del: useless -- https://master.php.net/note/delete/98849/useless
Del: bad code -- https://master.php.net/note/delete/98849/bad+code
Del: spam -- https://master.php.net/note/delete/98849/spam
Del: non-english -- https://master.php.net/note/delete/98849/non-english
Del: in docs -- https://master.php.net/note/delete/98849/in+docs
Del: other reasons-- https://master.php.net/note/delete/98849
Reject -- https://master.php.net/note/reject/98849
Search -- https://master.php.net/manage/user-notes.php