Index: phpqrcode/qrencode.php
--- phpqrcode/qrencode.php.orig	2010-08-18 07:06:24.000000000 +0200
+++ phpqrcode/qrencode.php	2011-11-05 10:45:20.000000000 +0100
@@ -280,10 +280,10 @@
         }
         
         //----------------------------------------------------------------------
-        public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false) 
+        public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false, $fgcolor = "000000", $bgcolor = "ffffff") 
         {
             $enc = QRencode::factory($level, $size, $margin);
-            return $enc->encodePNG($text, $outfile, $saveandprint=false);
+            return $enc->encodePNG($text, $outfile, $saveandprint=false, $fgcolor, $bgcolor);
         }
 
         //----------------------------------------------------------------------
@@ -477,7 +477,7 @@
         }
         
         //----------------------------------------------------------------------
-        public function encodePNG($intext, $outfile = false,$saveandprint=false) 
+        public function encodePNG($intext, $outfile = false,$saveandprint=false, $fgcolor = "000000", $bgcolor = "FFFFFF") 
         {
             try {
             
@@ -491,7 +491,7 @@
                 
                 $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
                 
-                QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
+                QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint, $fgcolor, $bgcolor);
             
             } catch (Exception $e) {
             
Index: phpqrcode/qrimage.php
--- phpqrcode/qrimage.php.orig	2010-08-18 07:06:24.000000000 +0200
+++ phpqrcode/qrimage.php	2011-11-05 10:41:13.000000000 +0100
@@ -27,9 +27,9 @@
     class QRimage {
     
         //----------------------------------------------------------------------
-        public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE) 
+        public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE, $fgcolor = "000000", $bgcolor = "FFFFFF") 
         {
-            $image = self::image($frame, $pixelPerPoint, $outerFrame);
+            $image = self::image($frame, $pixelPerPoint, $outerFrame, $fgcolor, $bgcolor);
             
             if ($filename === false) {
                 Header("Content-type: image/png");
@@ -48,9 +48,9 @@
         }
     
         //----------------------------------------------------------------------
-        public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85) 
+        public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85, $fgcolor = "000000", $bgcolor = "FFFFFF") 
         {
-            $image = self::image($frame, $pixelPerPoint, $outerFrame);
+            $image = self::image($frame, $pixelPerPoint, $outerFrame, $fgcolor, $bgcolor);
             
             if ($filename === false) {
                 Header("Content-type: image/jpeg");
@@ -63,7 +63,14 @@
         }
     
         //----------------------------------------------------------------------
-        private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4) 
+        private static function _rgb2array($rgb) {
+            return array(
+                base_convert(substr($rgb, 0, 2), 16, 10),
+                base_convert(substr($rgb, 2, 2), 16, 10),
+                base_convert(substr($rgb, 4, 2), 16, 10),
+            );
+        }
+        private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4, $fgcolor = "000000", $bgcolor = "FFFFFF") 
         {
             $h = count($frame);
             $w = strlen($frame[0]);
@@ -72,9 +79,12 @@
             $imgH = $h + 2*$outerFrame;
             
             $base_image =ImageCreate($imgW, $imgH);
+
+            $fg = self::_rgb2array($fgcolor);
+            $bg = self::_rgb2array($bgcolor);
             
-            $col[0] = ImageColorAllocate($base_image,255,255,255);
-            $col[1] = ImageColorAllocate($base_image,0,0,0);
+            $col[0] = ImageColorAllocate($base_image, $bg[0], $bg[1], $bg[2]);
+            $col[1] = ImageColorAllocate($base_image, $fg[0], $fg[1], $fg[2]);
 
             imagefill($base_image, 0, 0, $col[0]);
 
@@ -92,4 +102,4 @@
             
             return $target_image;
         }
-    }
\ No newline at end of file
+    }
