PHP-Snippets
 php::MySQL (0)
 php::Image (4)
   » Bild - Boxskalierung
   » Hex-Farbcode -> Farb-Array
   » Farb - Aufheller
   » Farb - Abdunkler
 php::Sonstiges (4)
   » Einfache Template-Funktion
   » Simple HTTP-Post Funktion
   » Simple HTTP-Get Funktion
   » zwischen()-Funktion
 php::Spezielles (2)
   » Zeichenvorkommisse prüfen
   » Array mischen (seeded)
Snippet: Farb - Abdunkler

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
<?php
function dfx_colordarker($color,$percentage 50// Farbe als RGB Array
{
    if(!isset(
$color['r']) || !isset($color['g']) || !isset($color['b']))
    {
        die(
"Not enough parameter!");
    }
    
$newcol['r'] = $color['r'] - round(($color['r']/100)*$percentage);
    
$newcol['g'] = $color['g'] - round(($color['g']/100)*$percentage);
    
$newcol['b'] = $color['b'] - round(($color['b']/100)*$percentage);

    return 
$newcol;    
}
?>