Add trick with dynamic wallpaper generation (#135)

This commit is contained in:
Ascii Moth 2023-07-29 08:50:28 +00:00 committed by GitHub
parent 2719a57e2b
commit c29f2e6f9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,3 +21,26 @@ in
'';
}
```
## Dynamic wallpaper generation based on selected theme
With imagemagick, you can also dynamically generate wallpapers based on the selected theme.
Similarly, you can use a template image and repaint it for the current theme.
```nix
{ pkgs, ... }:
let
theme = "${pkgs.base16-schemes}/share/themes/catppuccin.yaml";
wallpaper = pkgs.runCommand "image.png" {} ''
COLOR=$(${pkgs.yq}/bin/yq -r .base00 ${theme})
COLOR="#"$COLOR
${pkgs.imagemagick}/bin/magick convert -size 1920x1080 xc:$COLOR $out
'';
in {
stylix = {
image = wallpaper;
base16Scheme = theme;
};
}
```