-
Notifications
You must be signed in to change notification settings - Fork 351
User Template Files
As of version 1.0.0 pywal now supports user defined template files. What this means is that similar to the export files in the ~/.cache/wal/ directory you can now create your own files which will be processed by pywal and spit out in this directory.
The user defined files are read from ~/.config/wal/templates/ and are exported to ~/.cache/wal/ under the same name. Using this feature you can also overwrite the default export files, here's an example using rofi.
The default rofi configuration in pywal is a black background with white text. Say you want to invert these colors and have a white background with black text, here are the steps to do so.
- Find the default template file.
- https://github.com/dylanaraps/pywal/tree/master/pywal/templates
- For
rofiit's calledcolors-rofi.rasi.
- Create a file called
colors-rofi.rasiin~/.config/wal/templates. - Define your own colors for
rofiusing the values you want based on the original template.
// Example snippet.
* {{
active-background: {color2};
active-foreground: {foreground};
normal-background: {background};
normal-foreground: {foreground};
urgent-background: {color1};
urgent-foreground: {foreground};
// ...
}}
- Rerun
walto apply the new settings.
pywal's templating works by using Python's string formatting so it's builtin, quick and simple. Variables must be surrounded by {/} to be recognized and any existing curly-braces need to be escaped. To escape curly-braces you just double them, so { becomes {{ and so on.
Variables
-
{color0}-->{color15}: Colors 0-15. -
{background}: Background color. -
{foreground}: Foreground color. -
{cursor}: Cursor color. -
{wallpaper}: The full path to the current wallpaper.
Modifiers
Note: These apply to all variables minus wallpaper.
-
{var}: Output the color inhex. -
{var.rgb}: Output the color inrgb. -
{var.xrgba}: Output the color inxrgb. -
{var.strip}: Output the color inhex(without a#).