lib/PHPRtfLite/DocHead/ColorTable.php
private static function convertHexColorToRtf($color)
    {
        if (strlen($color) == 6) {
            $red    = hexdec(substr($color, 0, 2));
            $green  = hexdec(substr($color, 2, 2));
            $blue   = hexdec(substr($color, 4, 2));

            return '\red' . $red . '\green' . $green . '\blue' . $blue;
        }

        throw new PHPRtfLite_Exception('Color must be a hex number of length 3 or 6 digits! You gave me: #' . $color);
    }
private static function convertHexColorToRtf($color)
    {
        if (strlen($color) == 6) {
            $red    = hexdec(substr($color, 0, 2));
            $green  = hexdec(substr($color, 2, 2));
            $blue   = hexdec(substr($color, 4, 2));

            return '\red' . $red . '\green' . $green . '\blue' . $blue;
        }

        throw new PHPRtfLite_Exception('Color must be a hex number of length 3 or 6 digits! You gave me: #' . $color);
    }
private static function convertHexColorToRtf ( $ color ) { if ( strlen ( $ color ) == 6 ) { $ red = hexdec ( substr ( $ color , 0 , 2 ) ) ; $ green = hexdec ( substr ( $ color , 2 , 2 ) ) ; $ blue = hexdec ( substr ( $ color , 4 , 2 ) ) ; return '\red' . $ red . '\green' . $ green . '\blue' . $ blue ; } throw new PHPRtfLite_Exception ( 'Color must be a hex number of length 3 or 6 digits! You gave me: #' . $ color ) ; }
formats color code.

@param string $color Color
@return string rtf color
@throws PHPRtfLite_Exception, if color is not a 3or 6 digit hex number
formats color code .