public static function getColorCode($color, $options = array())
    {
        $code = (int) $color;
        if (is_string($color)) {
            $options = array_merge(explode('+', strtolower($color)), $options);
            $color = array_shift($options);
            if (!isset(self::$colors[$color])) {
                throw new ConsoleException("Unknown color '$color'");
            }
            $code = self::$colors[$color];
        }
        foreach ($options as $opt) {
            $opt = strtolower($opt);
            if (!isset(self::$options[$opt])) {
                throw new ConsoleException("Unknown option '$color'");
            }
            $code = $code | self::$options[$opt];
        }
        return $code;
    }
public static function getColorCode($color, $options = array())
    {
        $code = (int) $color;
        if (is_string($color)) {
            $options = array_merge(explode('+', strtolower($color)), $options);
            $color = array_shift($options);
            if (!isset(self::$colors[$color])) {
                throw new ConsoleException("Unknown color '$color'");
            }
            $code = self::$colors[$color];
        }
        foreach ($options as $opt) {
            $opt = strtolower($opt);
            if (!isset(self::$options[$opt])) {
                throw new ConsoleException("Unknown option '$color'");
            }
            $code = $code | self::$options[$opt];
        }
        return $code;
    }
public static function getColorCode ( $ color , $ options = array ( ) ) { $ code = ( int ) $ color ; if ( is_string ( $ color ) ) { $ options = array_merge ( explode ( '+' , strtolower ( $ color ) ) , $ options ) ; $ color = array_shift ( $ options ) ; if ( ! isset ( self :: $ colors [ $ color ] ) ) { throw new ConsoleException ( "Unknown color '$color'" ) ; } $ code = self :: $ colors [ $ color ] ; } foreach ( $ options as $ opt ) { $ opt = strtolower ( $ opt ) ; if ( ! isset ( self :: $ options [ $ opt ] ) ) { throw new ConsoleException ( "Unknown option '$color'" ) ; } $ code = $ code | self :: $ options [ $ opt ] ; } return $ code ; }
Returns a color code

$color can be a string with the color name, or one of the color constants.

@param int|string $color
@param array $options
@return int
Returns a color code