Skip to content

PYWAL CHEATSHEET

Pywal is a tool to generate/change theme colors for your terminal and several supported applications. External applications can tap into the theme generated and apply it to itself.

PYWAL INSTALLATION

Pywal can be installed via your package manager (if present) or via pip:

    pip install --user pywal

PYWAL PLUGINS

There are several plugins for pywal. I will detail a few that I currently am using.

WAL.VIM

wal.vim is a vim plugin. Install it via plug:

Firstly setup plug. Then inside your ~/.vimrc, add the line below to your plugs list:

    Plug 'dylanaraps/wal.vim'

Then add/modify the colorscheme line:

    colorscheme wal

Then issue the following command in vim:

    :PlugUpdate

Quit and restart vim and it should not have any errors, and if you have already set a pywal theme, it should apply.

RAZER-CLI

razer-cli is for those that have any Razer devices with configurable color(s), this tool will work with pywal to apply an appropriate color scheme.

This can be installed either via your package manager (if present) or via pip:

    pip install --user razer-cli

Then you can have it apply your pywal scheme via:

    razer-cli -a

To chain this with pywal the following will do the trick:

    wal -i ~/image.png && razer-cli -a

DISCORD

From the Github page, here is the quick start:

git clone https://github.com/guglicap/wal-discord.git
chmod +x ./wal-discord/wal-discord
ln -s "`pwd`/wal-discord/wal-discord" <directory in your $PATH>
wal-discord; beautifuldiscord --css ~/.cache/wal-discord/style.css

QT APPLICATIONS

In ~/.bashrc put

    export QT_QPA_PLATFORMTHEME=qt5ct

Install "qt5ct" and set theme to wal.

    sudo dnf install qt5ct

GTK APPLICATIONS

use lxappearance

    sudo dnf install lxappearance

I also found that wpgtk is a great tool too, that can help fringe cases.

    https://github.com/deviantfero/wpgtk/

    pip3 install -U wpgtk

I3WM CONFIG

Add/change the following lines to have what the pywal team recommends:

    #PYWAL ENABLED THEME
    set_from_resource $fg i3wm.color7 #f0f0f0
    set_from_resource $bg i3wm.color2 #f0f0f0
    # class                 border  backgr. text indicator child_border
    client.focused          $bg     $bg     $fg  $bg       $bg
    client.focused_inactive $bg     $bg     $fg  $bg       $bg
    client.unfocused        $bg     $bg     $fg  $bg       $bg
    client.urgent           $bg     $bg     $fg  $bg       $bg
    client.placeholder      $bg     $bg     $fg  $bg       $bg
    client.background       $bg

I personally modified the client focused text to be so that the title chages to black:

    client.focused          $bg     $bg     #000000

For your bar, you will want to do something similar to the following copy of what I chose to use in your bar section. Just add/modify the colors section:

    bar {
        colors {
                focused_workspace   $bg $bg #000000
                active_workspace    $fg $fg #000000
                inactive_workspace  $fg $fg #000000
        }
    }

ROFI CONFIG

Create or modify your existing ~/.config/rofi/config.rasi to have depending on your taste:

Dark:

    @import "~/.cache/wal/colors-rofi-dark"

Light:

    @import "~/.cache/wal/colors-rofi-light"

USING PYWAL

Firstly, ~/.bashrc needs a few lines to allow for taking pywal's changes:

    # Pywal
    (cat ~/.cache/wal/sequences &)
    source ~/.cache/wal/colors-tty.sh

You will want to have in your DE/WM startup the following to recall your last settings:

    wal -Rq

pywal can be quickly invoked to analyze an image via:

    wal -i /path/to/image.png

Or a directory:

    wal -i /path/to/directory

To apply a theme:

    wal --theme theme-name

To list available themes:

    wal --theme

PUTTING IT ALL TOGETHER

So, simply put there isn't much going on, but there are a few things that need to be done:

  1. Setup your ~/.bashrc
  2. Have your GUI call somehow the restoration command on login
  3. Tie in any plugins or external applications that need to talk with pywal

This works perfectly for me with the restoration in my bashrc and i3-gaps configs. I also created a bash function that invokes pywal then razer-cli to create a simple(r) experience. Modify accordingly for your plugins/external tools that will tie into your pywal generated color scheme.

    function pywal { 
            wal -i "$1" ; razer-cli -a ; i3-msg restart ; wal-discord ; beautifuldiscord --css $HOME/.cache/wal-discord/style.css ; wpg -s "$1";
            }
    export -f pywal

In my case I can do a:

    pywal /path/to/Image.png

And I will geta unified theme for GTK, QT, Discord, and Razer devices when using the OpenRazer driver.