CImage.php
public function setDefaultBackgroundColor($color)
    {
        $this->log("Setting default background color to '$color'.");

        if (!(strlen($color) == 6 || strlen($color) == 8)) {
            throw new Exception(
                "Background color needs a hex value of 6 or 8
                digits. 000000-FFFFFF or 00000000-FFFFFF7F.
                Current value was: '$color'."
            );
        }

        $red    = hexdec(substr($color, 0, 2));
        $green  = hexdec(substr($color, 2, 2));
        $blue   = hexdec(substr($color, 4, 2));

        $alpha = (strlen($color) == 8)
            ? hexdec(substr($color, 6, 2))
            : null;

        if (($red < 0 || $red > 255)
            || ($green < 0 || $green > 255)
            || ($blue < 0 || $blue > 255)
            || ($alpha < 0 || $alpha > 127)
        ) {
            throw new Exception(
                "Background color out of range. Red, green blue
                should be 00-FF and alpha should be 00-7F.
                Current value was: '$color'."
            );
        }

        $this->bgColor = strtolower($color);
        $this->bgColorDefault = array(
            'red'   => $red,
            'green' => $green,
            'blue'  => $blue,
            'alpha' => $alpha
        );

        return $this;
    }
public function setDefaultBackgroundColor($color)
    {
        $this->log("Setting default background color to '$color'.");

        if (!(strlen($color) == 6 || strlen($color) == 8)) {
            throw new Exception(
                "Background color needs a hex value of 6 or 8
                digits. 000000-FFFFFF or 00000000-FFFFFF7F.
                Current value was: '$color'."
            );
        }

        $red    = hexdec(substr($color, 0, 2));
        $green  = hexdec(substr($color, 2, 2));
        $blue   = hexdec(substr($color, 4, 2));

        $alpha = (strlen($color) == 8)
            ? hexdec(substr($color, 6, 2))
            : null;

        if (($red < 0 || $red > 255)
            || ($green < 0 || $green > 255)
            || ($blue < 0 || $blue > 255)
            || ($alpha < 0 || $alpha > 127)
        ) {
            throw new Exception(
                "Background color out of range. Red, green blue
                should be 00-FF and alpha should be 00-7F.
                Current value was: '$color'."
            );
        }

        $this->bgColor = strtolower($color);
        $this->bgColorDefault = array(
            'red'   => $red,
            'green' => $green,
            'blue'  => $blue,
            'alpha' => $alpha
        );

        return $this;
    }
public function setDefaultBackgroundColor ( $ color ) { $ this -> log ( "Setting default background color to '$color'." ) ; if ( ! ( strlen ( $ color ) == 6 || strlen ( $ color ) == 8 ) ) { throw new Exception ( "Background color needs a hex value of 6 or 8
                digits. 000000-FFFFFF or 00000000-FFFFFF7F.
                Current value was: '$color'." ) ; } $ red = hexdec ( substr ( $ color , 0 , 2 ) ) ; $ green = hexdec ( substr ( $ color , 2 , 2 ) ) ; $ blue = hexdec ( substr ( $ color , 4 , 2 ) ) ; $ alpha = ( strlen ( $ color ) == 8 ) ? hexdec ( substr ( $ color , 6 , 2 ) ) : null ; if ( ( $ red < 0 || $ red > 255 ) || ( $ green < 0 || $ green > 255 ) || ( $ blue < 0 || $ blue > 255 ) || ( $ alpha < 0 || $ alpha > 127 ) ) { throw new Exception ( "Background color out of range. Red, green blue
                should be 00-FF and alpha should be 00-7F.
                Current value was: '$color'." ) ; } $ this -> bgColor = strtolower ( $ color ) ; $ this -> bgColorDefault = array ( 'red' => $ red , 'green' => $ green , 'blue' => $ blue , 'alpha' => $ alpha ) ; return $ this ; }
Set default background color between 000000-FFFFFF or if using
alpha 00000000-FFFFFF7F.

@param string $color as hex value.

@return $this
Set default background color between 000000 - FFFFFF or if using alpha 00000000 - FFFFFF7F .