If you are It’s FOSS newsletter subscriber, you already know that we have started a new ‘Terminal Tuesday’ series. In this, you’ll get to read about command line tools or tips/tricks to help you in terminal.
This week’s terminal tip is a fun one. It’s about changing the color scheme of your terminal based on your wallpaper.
Why would you do that? Because it looks good and if you are sharing your Linux desktop screen, it adds a nice touch to the overall look.
Pywal: Handy utility to automatically change Linux terminal scheme based on background wallpaper
Pywal is nifty Python-based command line tool that changes the terminal colors based on the colors of that wallpapers.
You can use it to set the wallpaper and you’ll see that the terminal colors change immediately.
Take a look at this. Looks good, isn’t it?
Let me show you how to use Pywal properly.
Step 1: Install Pywal on Linux
Pywal is based on Python so you can easily install it on any Linux distribution with Python support. It is even easier for Arch/Manjaro users as they can find
python-pywal package in their repository.
You’ll need to install Pip first. You can use your distribution’s package manager to install pip3 (for Python3). On Debian/Ubuntu based distributions, you can use the following command:
sudo apt install pip3
Now that you have pip3 on your system, use it to install Pywal for all the users on your system:
sudo pip3 install pywal
Step 2: Using Pywal to change the terminal color scheme
I presume that you are a bit familiar with Linux commands to use Pywal.
Download the wallpaper of your choice. Make a note of the location of the wallpaper and its file name.
Open a terminal and use the
wal command with the location of your wallpaper file as input:
wal -i path_to_wallpaper_file
You’ll see that your system’s background is changed and the terminal changes it color immediately based on the background wallpaper:
Step 3: Make new terminal use the color scheme of wallpaper
Open a new terminal and you’ll notice that it doesn’t use the new color scheme.
Weird? Not so much. By default, the changes color scheme only applies to already running terminal screens. Newly opened terminals keep on using the system’s color scheme.
This can be changed easily. You can use change your shell’s configuration file.
Normally, you should be using bash shell but if you are not sure, check which shell you are using by default.
At the end of this ~/.bashrc file, add the following line, save and exit the file.
# Import colorscheme from 'wal' asynchronously # & # Run the process in the background. # ( ) # Hide shell job control messages. (cat ~/.cache/wal/sequences &) # Alternative (blocks terminal for 0-3ms) cat ~/.cache/wal/sequences # To add support for TTYs this line can be optionally added. source ~/.cache/wal/colors-tty.sh
Now the new color scheme will be applied to the new terminals as well.
Step 4: Keep the new color scheme even after reboot (if you want it)
When you reboot your system, pywal won’t run anymore and your terminal will revert to the old color scheme.
If you want to keep the color scheme based on the wallpaper, pywal provides a handy option
-R that restores the last used color scheme.
All you have to do is to add
wal -R command to the list of your startup programs.
This step could be different for different distributions. On Ubuntu, you can manage startup applications using the ‘Startup Applications’ program.
Add the command, give it a name and description like this:
Now Pywal run automatically at each reboot and restore the last used color scheme. In other words, your terminal will have the colors based on your desktop background (if it was setup by pywal).
Take the customization to the next level by adding the color scheme to other utilities
In many Linux communities, people share the screenshots of their desktop. It’s FOSS Facebook group hosts DesktopFriday post where members share their desktops and you’ll find them using Pywal for other applications as well.
Pywal has some plugins that extend the color scheme to Vim, Emacs, Gnuplot or even CLI-Visualizer (audio visualizer).
Do you like Pywal?
I understand that not everyone is into tweaking the looks and feels of their desktop but for those who do, Pywal is an awesome utility.
How about you? Did you like Pywal? Do you know some other utility of this kind that you would like to be covered under our ‘Terminal Tuesday’ series? I welcome your feedback and suggestions.