Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Join array elements with a string
Alias join
implode(string $separator, array $array): string
    public function applyForegroundColor(string $valuestring $color): string

    
{

        
$setCodes   implode(';'collection($this->parseColor($color))->toArray());

        
$unsetCodes implode(';'collection(['39'])->toArray());



        return 
sprintf(terminal()->getCsi() . '%sm'$setCodes) . $value sprintf(terminal()->getCsi() . '%sm'$unsetCodes);
    public function applyForegroundColor(string $valuestring $color): string

    
{

        
$setCodes   implode(';'collection($this->parseColor($color))->toArray());

        
$unsetCodes implode(';'collection(['39'])->toArray());



        return 
sprintf(terminal()->getCsi() . '%sm'$setCodes) . $value sprintf(terminal()->getCsi() . '%sm'$unsetCodes);

    }
    public function applyBackgroundColor(string $valuestring $color): string

    
{

        
$setCodes   implode(';'collection($this->parseColor($colortrue))->toArray());

        
$unsetCodes implode(';'collection(['49'])->toArray());



        return 
sprintf(terminal()->getCsi() . '%sm'$setCodes) . $value sprintf(terminal()->getCsi() . '%sm'$unsetCodes);
    public function applyBackgroundColor(string $valuestring $color): string

    
{

        
$setCodes   implode(';'collection($this->parseColor($colortrue))->toArray());

        
$unsetCodes implode(';'collection(['49'])->toArray());



        return 
sprintf(terminal()->getCsi() . '%sm'$setCodes) . $value sprintf(terminal()->getCsi() . '%sm'$unsetCodes);

    }
            return ($background '10' '9') . self::BRIGHT_COLORS[$color];

        }



        throw new 
InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).'$colorimplode(', 'array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));

    }