public static function style(string $name, array $style)
    {
        $allow = ['fg' => true, 'bg' => true, 'bold' => true];
        $style = \array_intersect_key($style, $allow);

        if (empty($style)) {
            throw new InvalidArgumentException('Trying to set empty or invalid style');
        }

        if (isset(static::$styles[$name]) || \method_exists(static::class, $name)) {
            throw new InvalidArgumentException('Trying to define existing style');
        }

        static::$styles[$name] = $style;
    }
public static function style(string $name, array $style)
    {
        $allow = ['fg' => true, 'bg' => true, 'bold' => true];
        $style = \array_intersect_key($style, $allow);

        if (empty($style)) {
            throw new InvalidArgumentException('Trying to set empty or invalid style');
        }

        if (isset(static::$styles[$name]) || \method_exists(static::class, $name)) {
            throw new InvalidArgumentException('Trying to define existing style');
        }

        static::$styles[$name] = $style;
    }
public static function style ( string $ name , array $ style ) { $ allow = [ 'fg' => true , 'bg' => true , 'bold' => true ] ; $ style = \ array_intersect_key ( $ style , $ allow ) ; if ( empty ( $ style ) ) { throw new InvalidArgumentException ( 'Trying to set empty or invalid style' ) ; } if ( isset ( static :: $ styles [ $ name ] ) || \ method_exists ( static :: class , $ name ) ) { throw new InvalidArgumentException ( 'Trying to define existing style' ) ; } static :: $ styles [ $ name ] = $ style ; }
Register a custom style.

@param string $name  Example: 'alert'
@param array  $style Example: ['fg' => Color::RED, 'bg' => Color::YELLOW, 'bold' => 1]

@return void
Register a custom style .