protected function coerceColor($value)
    {
        switch ($value[0]) {
            case Type::T_COLOR:
                return $value;

            case Type::T_KEYWORD:
                $name = strtolower($value[1]);

                if (isset(Colors::$cssColors[$name])) {
                    $rgba = explode(',', Colors::$cssColors[$name]);

                    return isset($rgba[3])
                        ? [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2], (int) $rgba[3]]
                        : [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2]];
                }

                return null;
        }

        return null;
    }
protected function coerceColor($value)
    {
        switch ($value[0]) {
            case Type::T_COLOR:
                return $value;

            case Type::T_KEYWORD:
                $name = strtolower($value[1]);

                if (isset(Colors::$cssColors[$name])) {
                    $rgba = explode(',', Colors::$cssColors[$name]);

                    return isset($rgba[3])
                        ? [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2], (int) $rgba[3]]
                        : [Type::T_COLOR, (int) $rgba[0], (int) $rgba[1], (int) $rgba[2]];
                }

                return null;
        }

        return null;
    }
protected function coerceColor ( $ value ) { switch ( $ value [ 0 ] ) { case Type :: T_COLOR : return $ value ; case Type :: T_KEYWORD : $ name = strtolower ( $ value [ 1 ] ) ; if ( isset ( Colors :: $ cssColors [ $ name ] ) ) { $ rgba = explode ( ',' , Colors :: $ cssColors [ $ name ] ) ; return isset ( $ rgba [ 3 ] ) ? [ Type :: T_COLOR , ( int ) $ rgba [ 0 ] , ( int ) $ rgba [ 1 ] , ( int ) $ rgba [ 2 ] , ( int ) $ rgba [ 3 ] ] : [ Type :: T_COLOR , ( int ) $ rgba [ 0 ] , ( int ) $ rgba [ 1 ] , ( int ) $ rgba [ 2 ] ] ; } return null ; } return null ; }
Coerce value to color

@param array $value

@return array|null
Coerce value to color