A LITTLE CORNER OF MY WORLD

Read a few words, keep a little time

Every moment worth recording has a light of its own.

Back to all posts
Everyday life

Create your own SwayFX/EWW theme

Your own SwayFX/EWW theme based on my last dotfiles.

On this page
  1. Wallpapers
  2. Material colors
  3. Clone the oomox-gtk-theme repository
  4. Clone my repository
  5. Generate your theme
  6. Install your theme
  7. Terminal colors with Aether
  8. Change the font
  9. Connect on EWW

Wallpapers

First, find a good wallpaper. For this guide, I’ll use this one: wall.alphacoders.com/big.php?i=998147 and my theme will be called supercat.

Material colors

You can use the Python tool m3wall to get a basic Material color scheme. Before using m3wall, you have to install and configure python3-pip

xbps-install -S python3-pip python3-devel python3-Pillow
python3 -m venv ~/.python

This will create your local Python environment.

git clone https://github.com/MDiaznf23/m3wal.git
cd m3wal
~/.python/bin/pip install material-color-utilities
~/.python/bin/pip install -e .

Unless you add $HOME/.python/bin to your PATH variable, you have to use ~/.python/bin/m3wall instead of just m3wall.

m3wall has the --variant option, so don’t hesitate to try different values.

m3wal wallpaper.jpg --generator-only --mode dark --variant AUTO
m3wal wallpaper.jpg --generator-only --mode dark --variant VIBRANT
m3wal wallpaper.jpg --generator-only --mode dark --variant FIDELITY
m3wal wallpaper.jpg --generator-only --mode dark --variant EXPRESSIVE
m3wal wallpaper.jpg --generator-only --mode dark --variant CONTENT
m3wal wallpaper.jpg --generator-only --mode dark --variant TONALSPOT

This generates colours in ~/.config/m3-colors. We only need to use the JSON file at .config/m3-colors/output/wallpaper_FIDELITY_dark_scheme.json

Clone the oomox-gtk-theme repository

My script will use oomox to generate your GTK theme, so you’ll need to clone it to ~/labs/oomox-gtk-theme/

git clone https://github.com/themix-project/oomox-gtk-theme ~/labs/oomox-gtk-theme

Oomox-gtk has a few dependencies. Please check the repository for the dependencies required by your Linux distribution.

xbps-install gdk-pixbuf sassc gtk+3 bc glib-devel librsvg-utils

The last thing we need is my dotfiles.

Clone my repository

To clone my dotfiles:

git clone https://github.com/szorfein/dotfiles ~/.dotfiles

Generate your theme

With all the dependencies in place, you can use my script to generate your theme:

We execute gen-theme-m3wall.sh with a few parameters:

~/.dotfiles/swayfx/bin/gen-theme-m3wal.sh ~/.config/m3-colors/output/wallpaper_FIDELITY_dark_scheme.json supercat

So, The first argument is the JSON generated by m3wall; the second parameter is the new name of your theme, it can be anything…

Install your theme

If you’ve never installed my dotfiles, you need to install your theme with at least --swayfx supercat:

./stow.sh --purge --kitty --swayfx supercat --neovim --tmux --zsh

Otherwise, if Sway is alrealy installed, you only have to change the theme:

~/.config/eww/scripts/change-theme.sh supercat

Terminal colors with Aether

m3wall is good for the materials colors, but your terminal is surely ugly a lot. The best tool i recommand you is Aether from the Omarchy project.

wget https://github.com/omacom/aether/releases/download/v4.32.0/aether-linux-amd64
chmod +x aether-linux-amd64
./aether-linux--amd64

The release v4.32.0 works for me, but not the last.

Once the app open, choose your wallppaper and click on Extract. Now edit your JSON theme wallpaper_FIDELITY_dark_scheme.json to update your terminal value:

$EDITOR ~/.config/m3-colors/output/wallpaper_TONALSPOT_dark_scheme.json
"term0":"#000201",
"term1":"#879c5e",
"term2":"#87D49D"
"term3":"#B6FFB8",
"term4":"#159085",
"term5":"#20BFC7",
"term6":"#6BF4C3",
"term7":"#FDFFE5",
"term8":"#575E5A",
"term9":"#9AB465",
"term10":"#89F1A9",
"term11":"#A9FFAE",
"term12":"#00A99C",
"term13":"#00DBE5",
"term14":"#5BFFD5",
"term15":"#EDF8F1",

A last word about color, I recommend always keeping a true Red color for term1 and term9, #d11548, #ff7663

After that, just relauch the theme generator and reinstall the theme

~/.dotfiles/swayfx/bin/gen-theme-m3wal.sh ~/.config/m3-colors/output/wallpaper_FIDELITY_dark_scheme.json supercat
~/.config/eww/scripts/change-theme.sh supercat

Change the font

The default branded font used is “demova”, you have to change it.

You also need a “branded font”, I found them at dafont.com. For example, if you’re looking for a font around the theme of cats, go to: dafont.com/search.php?q=cat Add all the fonts you think would look cool with your wallpaper. We’ll test them later.

$EDITOR ~/.config/ryvst/supercat.yml
every_time: 5m
execute: fc-cache -f
tasks:
  - name: tomcat.zip
    url: https://dl.dafont.com/dl/?f=tomcat_2
    to_dest: .local/share/fonts/supercat
  - name: citcat.zip
    url: https://dl.dafont.com/dl/?f=citcat
    to_dest: .local/share/fonts/supercat
  - name: catways.zip
    url: https://dl.dafont.com/dl/?f=catways
    to_dest: .local/share/fonts/supercat
  - name: catmark.zip
    url: https://dl.dafont.com/dl/?f=cat_mark
    to_dest: .local/share/fonts/supercat
  - name: yellocat.zip
    url: https://dl.dafont.com/dl/?f=yello_cat
    to_dest: .local/share/fonts/supercat
  - name: yellowcat.zip
    url: https://dl.dafont.com/dl/?f=yellow_cat_2
    to_dest: .local/share/fonts/supercat
  - name: graphiccat.zip
    url: https://dl.dafont.com/dl/?f=graphic_cat
    to_dest: .local/share/fonts/supercat

Save the file and launch Ryvst from the command line: ryvst, Ryvst will install and update your font directory in few seconds.

Priviligy font which include number in their typography, it always look better.

Test all the font one by one. Check their name with fc-match:

fc-match -a | grep -i hello
Hello Catty.otf: "Hello Catty" "Regular"

Edit the EWW config

$EDITOR ~/.config/eww/styles/typography.scss
brand: "Hello Catty";

You can adjust the size of the $brand on the class .display_large, .display_medium if need.

Connect on EWW

Last setting, add your image in the convert-imgs.sh, the script will minimize your image at start.

$EDITOR ~/.config/eww/daemons/convert-imgs.sh
IMGS_DIR="$HOME/images/"
IMGS="holy.jpg jinx.png abyss.png vibe.png valyria.jpg wallpaper.png"

And add your theme in the changetheme widget

$EDITOR ~/.config/eww/windows/changetheme.yuck
            (card-image :path_image "/tmp/wallpaper.jpg" :title "SuperCat" :onclick "${eww_scripts}/dialog.sh close changetheme && ${eww_scripts}/change-theme.sh supercat &")
            (card-image :path_image "/tmp/valyria.jpg" :title "Valyria" :onclick "${eww_scripts}/dialog.sh close changetheme && ${eww_scripts}/change-theme.sh valyria &")
            (card-image :path_image "/tmp/vibe.png" :title "Vibe" :onclick "${eww_scripts}/dialog.sh close changetheme && ${eww_scripts}/change-theme.sh vibe &")

Add you theme before others “in First”, the :path_image will be created on your next reboot based on the image name.

And it’s all, it take some time but you have your wallpaper and colour, enjoy :)

✿

Thank you for reading. I hope these words were useful.

Szorfein
Szorfein / Author

A little code, a little everyday life. Say hello in the guestbook. Guestbook