{ config, pkgs, ... }:

{
  home.packages = with pkgs; [ papirus-icon-theme ];

  programs.rofi = {
    enable = true;
    font = "SF Pro Rounded 13";
    extraConfig = {
      show-icons = true;
      icon-theme = "Papirus";
      kb-cancel = "Super_L+XF86Launch5,Escape";
      combi-hide-mode-prefix = true;
    };
    theme = let inherit (config.lib.formats.rasi) mkLiteral;
    in {
      "*" = {
        background = mkLiteral "#0f111a";
        foreground = mkLiteral "#f1f1f1";
        selected = mkLiteral "#0033a1";
        selected-text = mkLiteral "#ffffff";
      };

      "window" = {
        transparency = "real";
        background-color = mkLiteral "@background";
        text-color = mkLiteral "@foreground";
        width = mkLiteral "800px";
        border-radius = mkLiteral "5px";
      };

      "textbox-prompt-colon" = {
        expand = mkLiteral "false";
        background-color = mkLiteral "@background";
        padding = mkLiteral "4px 0px 0px 6px";
      };

      "inputbar" = {
        children = mkLiteral "[ textbox-prompt-colon, entry ]";
        background-color = mkLiteral "@background";
        text-color = mkLiteral "@foreground";
        expand = mkLiteral "false";
        border = mkLiteral "0px 0px 0px 0px";
        border-radius = mkLiteral "0px";
        border-color = mkLiteral "@selected";
        margin = mkLiteral "0px 0px 0px 0px";
        padding = mkLiteral "0px 0px 4px 0px";
        position = mkLiteral "center";
      };

      "entry" = {
        background-color = mkLiteral "@background";
        text-color = mkLiteral "@foreground";
        placeholder-color = mkLiteral "@foreground";
        expand = mkLiteral "true";
        horizontal-align = mkLiteral "0";
        blink = mkLiteral "true";
        padding = mkLiteral "4px 0px 0px 4px";
        font = "SF Pro Rounded 25";
      };

      "case-indicator" = {
        background-color = mkLiteral "@background";
        text-color = mkLiteral "@foreground";
        spacing = mkLiteral "0";
      };

      "listview" = {
        background-color = mkLiteral "@background";
        columns = mkLiteral "1";
        spacing = mkLiteral "5px";
        cycle = mkLiteral "true";
        dynamic = mkLiteral "true";
        layout = mkLiteral "vertical";
        fixed-height = "true";
        lines = mkLiteral "5";
      };

      "mainbox" = {
        background-color = mkLiteral "@background";
        children = mkLiteral "[ inputbar, message, listview ]";
        spacing = mkLiteral "20px";
        padding = mkLiteral "20px 15px 15px 15px";
      };

      "message" = {
        children = mkLiteral "[ textbox ]";
        border-radius = mkLiteral "5px";
      };

      "textbox" = {
        background-color = mkLiteral "@selected";
        text-color = mkLiteral "@foreground";
        padding = mkLiteral "20px 6px 20px 80px";
      };

      "element" = {
        background-color = mkLiteral "@background";
        text-color = mkLiteral "@foreground";
        orientation = mkLiteral "horizontal";
        border-radius = mkLiteral "4px";
        padding = mkLiteral "2px 2px 2px 2px";
      };

      "element-text, element-icon" = {
        background-color = mkLiteral "inherit";
        text-color = mkLiteral "inherit";
      };

      "element-icon" = {
        size = mkLiteral "40px";
        border = mkLiteral "10px";
      };

      "element-text" = { padding = mkLiteral "20px 0px 0px 10px"; };

      "element selected" = {
        background-color = mkLiteral "@selected";
        text-color = mkLiteral "@selected-text";
        border = mkLiteral "0px";
        border-radius = mkLiteral "3px";
        border-color = mkLiteral "@selected";
      };
    };
  };
}
