Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-24.11] cava: init with rainbow theme #731

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions modules/cava/hm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{ config, lib, ... }:

let

mkGradient = colors: lib.listToAttrs (lib.imap0 (i: c: lib.nameValuePair "gradient_color_${toString (i+1)}" "'#${c}'") colors) // {
gradient = 1;
gradient_count = 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 = config.lib.stylix.mkEnableTarget "rainbow gradient theming" false;
};

config = let
cfg = config.stylix.targets.cava;
in
lib.mkIf (config.stylix.enable && cfg.enable) {
programs.cava.settings.color = lib.mkIf cfg.rainbow.enable (
mkGradient rainbowColors
);
};
}
Loading