Automatically Change Color Scheme of Your Linux Terminal Based on Your Wallpaper

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 the terminal.

Terminal is not all about serious work, it can be fun sometimes. You can play games in terminal or use some funny Linux commands to amuse yourself, colleagues, or family members.

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 the 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?

Change Linux terminal color based on wallpaper

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 python3-pip

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 its color immediately based on the background wallpaper:

Pywal Linux terminal colorscheme

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 changed 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 the bash shell but if you are not sure, check which shell you are using by default.

Open ~/.bashrc file in your favorite terminal based text editor. On Ubuntu, you can always use the nano editor.

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/

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:

Autostart Pywal

Now Pywal runs 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 set up 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 desktops. It’s FOSS Facebook group hosts DesktopFriday posts 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).

Credit: cli-visualizer

You can also use Pywal with window managers like i3, sway, and taskbars like polybar. Plenty of customization scope if you are interested.

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.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world


Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.