{ pkgs, ... }:

{
  programs.zed-editor = {
    enable = true;
    package = if pkgs.stdenv.isDarwin then null else pkgs.zed-editor;
    extensions = [
      "nix"
      "toml"
      "rust"
      "git-firefly"
    ];
    userSettings = {
      "autosave" = "on_focus_change";
      "ui_font_size" = 16;
      "buffer_font_size" = 15;

      "theme" = {
        "mode" = "system";
        "light" = "One Light";
        "dark" = "One Dark";
      };

      "theme_overrides" = {
        "One Light" = {
          "background" = "#FDF7F9";
          "status_bar.background" = "#FDF7F9";
          "title_bar.background" = "#FDF7F9";
          "elevated_surface.background" = "#FDF7F9";

          "surface.background" = "#FDF7F9";
          "panel.background" = "#FDF7F9";
          "editor.gutter.background" = "#FDF7F9";
          "tab_bar.background" = "#FDF7F9";
          "toolbar.background" = "#FDF7F9";
          "terminal.background" = "#FDF7F9";

          "editor.background" = "#00000000";

          "editor.line_number" = "#A38F96";
          "border" = "#F2E6EA";
          "hint.background" = "#F7EBEE";
          "editor.active_line_number" = "#191013";

          "tab.active_background" = "#8165701a";
          "element.selected" = "#8165701a";
          "tab.inactive_background" = "#FDF7F9";

          "editor.indent_guide" = "#F2E6EA";
          "editor.indent_guide_active" = "#E6D5DB";
          "panel.indent_guide" = "#F2E6EA";
          "panel.indent_guide_hover" = "#E6D5DB";
          "panel.indent_guide_active" = "#D9C4CC";

          "panel.focused_border" = "#00000000";
          "element.active" = "#81657029";
          "border.variant" = "#00000000";
          "scrollbar.track.border" = "#00000000";
          "editor.active_line.background" = "#8165700f";
          "scrollbar.track.background" = "#00000000";
          "scrollbar.thumb.background" = "#A38F9680";
          "ghost_element.background" = "#00000000";
          "element.hover" = "#8165700f";
          "ghost_element.hover" = "#8165700f";
          "ghost_element.active" = "#8165701a";
          "ghost_element.selected" = "#81657024";
          "drop_target.background" = "#8165701a";
          "editor.highlighted_line.background" = "#8165701a";
        };

        "One Dark" = {
          "background" = "#191017";
          "status_bar.background" = "#191017";
          "title_bar.background" = "#191017";
          "elevated_surface.background" = "#191017";

          "surface.background" = "#191017";
          "panel.background" = "#191017";
          "editor.gutter.background" = "#191017";
          "tab_bar.background" = "#191017";
          "toolbar.background" = "#191017";
          "terminal.background" = "#191017";

          "editor.background" = "#00000000";

          "editor.foreground" = "#FAFAFA";
          "text" = "#FAFAFA";
          "text.muted" = "#A9A9B1";
          "editor.line_number" = "#A38F96";
          "editor.active_line_number" = "#FAFAFA";

          "border" = "#2C1F2D";
          "hint.background" = "#2C1F2D";

          "tab.active_background" = "#2C1F2D";
          "tab.inactive_background" = "#191017";
          "element.selected" = "#2C1F2D";
          "element.active" = "#2C1F2D99";
          "element.hover" = "#2C1F2D80";

          "editor.indent_guide" = "#2C1F2D";
          "editor.indent_guide_active" = "#4A354C";
          "panel.indent_guide" = "#2C1F2D";
          "panel.indent_guide_hover" = "#4A354C";
          "panel.indent_guide_active" = "#604562";

          "panel.focused_border" = "#00000000";
          "border.variant" = "#00000000";
          "scrollbar.track.border" = "#00000000";
          "editor.active_line.background" = "#2C1F2D66";
          "scrollbar.track.background" = "#00000000";
          "scrollbar.thumb.background" = "#A38F9680";
          "ghost_element.background" = "#00000000";
          "ghost_element.hover" = "#2C1F2D80";
          "ghost_element.active" = "#2C1F2D99";
          "ghost_element.selected" = "#2C1F2DCC";
          "drop_target.background" = "#2C1F2D99";
          "editor.highlighted_line.background" = "#2C1F2D99";
        };
      };
    };
  };
}
