20 stable releases

3.0.0-alpha Feb 14, 2024
2.10.0 Jan 26, 2024
2.9.0 Dec 26, 2023
2.7.1 Sep 24, 2023
1.0.0 Mar 30, 2023

#132 in Command line utilities

Download history 13/week @ 2024-01-26 61/week @ 2024-02-09 13/week @ 2024-02-16 19/week @ 2024-02-23 14/week @ 2024-03-01 5/week @ 2024-03-08 29/week @ 2024-03-15 79/week @ 2024-03-29 2/week @ 2024-04-05 344/week @ 2024-04-19

425 downloads per month

MIT license

195KB
3.5K SLoC

Rust 3K SLoC // 0.1% comments BASH 335 SLoC PowerShell 142 SLoC Elvish 127 SLoC

wallust - Generate colors from an image

crates io downloads license dependency status CodeBerg MatrixChat

gif

sources: adwaita - scenic view of mountains - rms by marco novo - pixels - linus talking

If comming from v2, please check how to prepare for v3.

Usage

wallust run my_wallpaper.png

use wallust -h for an overview and wallust --help for a more detailed explanation

Features

  • Includes man pages and completions!
  • Sets terminal colors on all active terminals
  • Cache scheme palettes, overwritten by -w
    • Linux: $XDG_CACHE_HOME or $HOME/.cache
    • MacOs: $HOME/Library/Caches
    • Windows: {FOLDERID_LocalAppData}
  • Read pywal/terminal-sexy colorschemes with cs subcommand
  • Built-in pywal themes with the theme subcommand (can be disabled with compile-time features) wallust theme --help to list possible themes
  • Configuration file, wallust.toml:
    • When no config file, the default config file will be generated
    • Optional templating with two different engines:
      • Default is using usual {variable}
      • By enabling new_engine = true, you use {{variable}}
    • Configurable methods for backends, colorspaces and palettes (chart below)
    • Configurable threshold
    • Linux: $XDG_CONFIG_HOME or $HOME/.config
    • MacOs: $HOME/Library/Application Support
    • Windows: {FOLDERID_RoamingAppData}
Methods Description
Backends How to extract the colors from the image. (e.g pywal uses convert)
ColorSpace Get the most prominent color, and sort them according to the Palette, configurable by a threshold
Palette Makes a scheme palette with the gathered colors, (e.g. sets light background)

Make sure to read the sample config file for practical documentation.

For detailed docs:

  • man wallust, overall info;
  • man wallust.5, config docs;
  • man wallust-subcommand, displays a man page for subcommand.

Installation

wallust doesn't require third party packages, but has an optional dependency: imagemagick to use the wal backend (just like pywal). Other methods are built in.

Distros Packages

NetBSD

If you are using NetBSD, a native package is available from the official repositories. To install it, simply run:

pkgin install wallust

Nix

If you are using Nix, a native package is available for the unstable channel.

Install it for your profile:

nix-env -iA nixos.wallust # change `nixos` for `nixpkgs`, if on a non-NixOS system

Try it with nix-shell

nix-shell -p wallust

Arch User Repository (AUR)

Using an Arch based distro, you can use the wallust or wallust-git packages.

  • wallust fetches the latest stable version from static.crates.io, which mirrors the master branch. Prefer this package.
  • wallust-git fetches the latest unstable version from the dev branch.

Either can be installed on an Arch based distro with the following commands:

git clone https://aur.archlinux.org/wallust.git # Or wallust-git.git
cd wallust # or wallust-git
makepkg -si

Binary

Go to the releases and download the tar.gz file, which contains a binary for musl, so it should work for most *nix platforms.

tar -xf wallust-TARGET.tar.gz

Build from source

The master branch is stable

From this repo

Go to the releases page and download the .zip or .tar.gz repository. After extracting the contents, go to the directory (cd MAYOR.MINOR.PATCH).

Recommended way is to use the Makefile, since this will install man pages and completions.

  1. Edit Makefile to meet your local setup (should be fine as is for most linux distros).
  2. Build it with make
  3. Install wallust (if necessary as root): make install

Then you can do the following, which moves the binary into your $CARGO_HOME/bin

cargo install --path .

or build it and copy the binary to one folder present in your $PATH like /usr/local/bin

cargo build --release
cp -f ./target/release/wallust /usr/local/bin

From crates.io

cargo install wallust

This will use the lastest version

Packaging

Binary-based distros can grab the latest pre-compiled binary from the releases page.

Source-based distros, if they wish to build wallust from source, must ensure that the following dependencies are available:

  • Build Dependencies:
    1. Rust (cargo, rustc)
    2. make (or install man pages and completions manually)
  • Runtime Dependencies
    1. imagemagick is required only for the wal backend, such limiting should be mentined and considered an optional dependency, since all other backends work without it.

Makefile

Using make is optional if you know your way into cargo and can accept the job to manually install man pages, completions and the binary.

I've only added a Makefile to simplify installing these assets, as well as the binary. By default make uses native compilation, you can define your wished target like this:

Building

$ TARGET=x86_64-pc-windows-gnu make install CARGOFLAGS="--release --target=$TARGET"

Installing

# TARGET=x86_64-pc-windows-gnu make CARGOFLAGS="--release --target=$TARGET" RELEASE="target/$TARGET/release"

Don't forget that make by itself runs cargo in order to built the binary. It's common on projects that use make to split building in two steps, given that make install requires permissions to write on $DESTDIR$PREFIX.

Contribute!

Use the dev branch

Show some of your taste by adding a backend, colorspace, scheme palettes, and/or a custom theme.

Having design ideas or suggestios is also very welcome.

TODOs

for more, grep the src for TODO rg TODO

  • automate binary releases with a CI, figure out woodkeeper codeberg CI
  • use thiserror for errors in the modules (there aren't that many)

Dependencies

~22–34MB
~331K SLoC