Fun at the Laravel Console
February 10, 2020
What interested me the most was not the logo itself, but rather the custom colors. I admit I haven't dug deep before into what makes these console commands tick. To my knowledge, Laravel doesn't offer custom colors out of the box.
Enter Symfony's Console Formatter
It's all downhill from here
Armed with this knowledge, the
<fg=cyan>...</> tags in Livewire's code made perfect sense now.
For my future convenience I created the following two commands:
1. List all the default Symfony styles
2. Generate a Ghostbusters logo
The Ghostbusters logo was copied from this lovely repository of ASCII art. The Laravel console command in the gist generates the colored logo in the main article image.
Let's take a closer look at what colors and styles are available and how they can be applied.
Usage (each style is its own individual tag):
You may certainly combine the above to produce custom effects.
$this->line('<fg=blue;options=blink;bg=yellow>blue text on yellow background</>'); $this->line('Clickable URL: <href=https://github.com;fg=blue;options=underscore>github.com</>');
I don't know about you but I'll be sure to make my future Laravel console command output more colorful!Laravel