How I added colors to Laravel Solo
On this page
I recently discovered Laravel Solo (from Aaron Francis), and I found it a joy to use.
I mainly run Vite, Queues, Logs, and a Stripe CLI listener. But after I got everything set up, I got annoyed by a tiny detail: only the Vite tab had color highlighting. Bummer!
After googling around, I found that, for the Queues and Logs artisan commands, I could pass the --ansi
flag to output colors in a format Solo can understand.
And for the Stripe CLI command (which I'm running through NPM) you can set a --color=on
flag.
Here's how my setup looked:
// SoloServiceProvider.php
<?php
namespace App\Providers;
use AaronFrancis\Solo\Commands\EnhancedTailCommand;
use AaronFrancis\Solo\Facades\Solo;
use Illuminate\Support\ServiceProvider;
class SoloServiceProvider extends ServiceProvider
{
public function register()
{
if (class_exists('\AaronFrancis\Solo\Manager')) {
$this->configure();
}
}
public function configure()
{
Solo::useTheme('dark')
->addCommands([
'Vite' => 'npm run dev',
'Stripe' => 'npm run stripe -- --color=on',
'Queue' => 'php artisan queue:work --ansi',
'Logs' => 'php artisan pail --ansi',
])
->addLazyCommands([])
->allowCommandsAddedFrom([]);
}
public function boot()
{
}
}