{
  config,
  lib,
  ...
}: let
  cfg = config.programs.fzf.rose-pine;
  enable = cfg.enable && config.programs.fzf.enable;
  palette = (lib.importJSON "../../.sources/palette.json").${cfg.flavor}.colors;
in {
  options.programs.fzf.rose-pine =
    lib.rp.mkRosePineOpt {name = "fzf";};

  config.programs.fzf.colors =
    lib.mkIf enable
    # Manually populate with colors from rose-pine/fzf
    # The ordering is meant to match the order of rose-pine/fzf to make
    # comparison easier
    (
      lib.attrsets.mapAttrs (_: color: palette.${color}.hex) {
        fg = "subtle";
        bg = "base";
        hl = "rose";
        "fg+" = "text";
        "bg+" = "overlay";
        "hl+" = "rose";
        border = "highlight-med";
        header = "pine";
        gutter = "base";
        spinner = "gold";
        info = "foam";
        pointer = "iris";
        marker = "love";
        prompt = "subtle";
      }
    );
}
