When browsing forums related to Linux ricing, there is always one common denominator: a color palette which perfectly matches the background image.

A screenshot depicting a Linux dekstop rice Image Source

Traditionally, the tool to achieve this was pywal, but it is now discontinued and replaced by several alternatives such as Wallust or Matugen. Personally I use Matugen because I prefer its outputs over other tools.

Basics of color palette generation

All color palette tools work similarly: your background image (or set of colors/a static color) is your input, and as an output you receive a color palette which can be used for various programs. This is usually paired with templates for each software, where placeholders get replaced by the colors of your generated palette.

For matugen, this can be done using following command:


      matugen image /path/to/img
      

Assuming you have templates set up in your config, this should output them to their respective paths. While this works, the main caveat is that every time you switch your wallpaper, you have to run this command again.

One integration which I found particularly nice was the template for the application launcher I use, Vicinae. It has a whole section in the docs explaining how to integrate Matugen, which is quite nice.

Automating color generation

So the next step in your perfect color-matched setup is automating the process, i.e. switching your wallpaper automatically updates your generated color palette for all apps.

In my case, I am using Waypaper to switch wallpapers in combination with awww as my wallpaper daemon.

To execute something after changing the wallpaper in Waypaper, you can add a command to the post_command option in the config.ini:


      matugen image $(awww query | sed 's/.*image: //')  \
        -m dark --source-color-index 0
      

Because this command is composed of quite a few pieces, lets dissect it:

And that's it! Now when switching the background image in Waypaper, all programs that have templates configured automatically update their colors. In some cases, they don't have hot reload so you have to restart them (but there are workarounds for certain applications).