cava: init with rainbow theme

This commit is contained in:
bricked 2024-11-18 19:50:19 +01:00
parent f8699483e4
commit 9e389c695a
No known key found for this signature in database
GPG key ID: 7B4D2A02BB0EC28C

29
modules/cava/hm.nix Normal file
View file

@ -0,0 +1,29 @@
{ config, lib, ... }:
let
mkGradient = colors: lib.listToAttrs (lib.imap0 (i: c: lib.nameValuePair "gradient_color_${toString (i+1)}" "'#${c}'") colors) // {
gradient = "1";
gradient_count = toString (builtins.length colors);
};
rainbowColors = with config.lib.stylix.colors; [
base0E
base0D
base0C
base0B
base0A
base09
base08
];
in {
options.stylix.targets.cava = {
enable = config.lib.stylix.mkEnableTarget "CAVA" true;
rainbow.enable = lib.mkEnableOption "rainbow gradient theming";
};
config = lib.mkIf (config.stylix.enable && config.stylix.targets.cava.enable) {
programs.cava.settings.color = lib.mkIf config.stylix.targets.cava.rainbow.enable (mkGradient rainbowColors);
};
}