fzf: use Home Manager color options (#454)

home-manager provides a programs.fzf.colors option to provide colors.
This module basically reimplemented the logic Home Manager has as well.
This commit is contained in:
Anton Mosich 2024-06-27 23:59:30 +02:00 committed by GitHub
parent 7cdbd12817
commit 1ff9d37d27
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,11 @@
{ config, lib, ... }:
let
mkFzfKeyValue = lib.generators.mkKeyValueDefault { } ":";
{
options.stylix.targets.fzf = {
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
};
colorConfig = with config.lib.stylix.colors.withHashtag;
lib.concatStringsSep "," (lib.mapAttrsToList mkFzfKeyValue {
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
programs.fzf.colors = with config.lib.stylix.colors.withHashtag; {
"bg" = base00;
"bg+" = base01;
"fg" = base04;
@ -16,14 +18,6 @@ let
"pointer" = base0C;
"prompt" = base0A;
"spinner" = base0C;
});
in
{
options.stylix.targets.fzf = {
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
};
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
programs.fzf.defaultOptions = lib.mkAfter [ "--color=${colorConfig}" ];
};
};
}