{ config, lib, ... }:
let 
  usernameBG  = "#${config.lib.stylix.colors.base08}";
  directoryBG = "#${config.lib.stylix.colors.base09}";
  statusBG    = "#${config.lib.stylix.colors.base0A}";
  errorBG     = "#${config.lib.stylix.colors.base0B}";
  timeBG      = "#${config.lib.stylix.colors.base06}";

  usernameFG  = "#${config.lib.stylix.colors.base06}";
  directoryFG = "#${config.lib.stylix.colors.base07}";
  statusFG    = "#${config.lib.stylix.colors.base01}";
  errorFG     = "#${config.lib.stylix.colors.base00}";
  timeFG      = "#${config.lib.stylix.colors.base0C}";

  # blackColor     = "#${config.lib.stylix.colors.base00}";
  # whiteColor     = "#${config.lib.stylix.colors.base06}";
in 
  {
  programs.starship = {
    enable = true;
    enableBashIntegration = true;
    enableFishIntegration = true;
    settings = {
      format = lib.concatStrings [
#         "[](${usernameBG})"
#         "$username"
#         "$hostname"
#         "[](bg:${directoryBG} fg:${usernameBG})"
        "[](${directoryBG})"
        "$directory"
        "[](fg:${directoryBG} bg:${statusBG})"
        "$git_branch"
        "$git_status"
        "$rust"
        "$docker_context"
        "$nix_shell"
        "[](fg:${statusBG} bg:${errorBG})"
        "$status"
        "[ ](fg:${errorBG})"
      ];

      username = {
        show_always = true;
        style_user = "fg:${usernameFG} bg:${usernameBG}";
        style_root = "fg:${usernameFG} bg:${usernameBG}";
        format = "[$user]($style)";
        disabled = false;
      };

      hostname = {
        ssh_only = true;
        style = "fg:${usernameFG} bg:${usernameBG}";
        format = "[@$hostname]($style)";
        disabled = false;
      };

      os = {
        style = "bg:${usernameBG}";
        disabled = true;
      };

      nix_shell = {
        disabled = false;
        heuristic = true;
        symbol = " ";
        format = "[$symbol]($style)";
        style = "fg:${statusFG} bg:${statusBG}";
      };
 
      directory = {
        style = "fg:${directoryFG} bg:${directoryBG}";
        format = "[ $path ]($style)";
        truncation_length = 3;
        truncation_symbol = "…/";
        substitutions = {
          Documents = "󰈙 ";
          Downloads = " ";
          Music = " ";
          Pictures = " ";
        };
      };

      git_branch = {
        symbol = "";
        style = "fg:${statusFG} bg:${statusBG}";
        format = "[ $symbol $branch ]($style)";
      };

      git_status = {
        style = "fg:${statusFG} bg:${statusBG}";
        format = "[$all_status$ahead_behind ]($style)";
      };

      status = {
        style = "fg:${errorFG} bg:${errorBG}";
        format = "[ $status]($style)";
        disabled = false;
      };

      rust = {
        disabled = false;
        format = "[ via $symbol($version )]($style)";
        style = "fg:${statusFG} bg:${statusBG}";
      };
      
      time = {
        disabled = false;
        time_format = "%R"; # Hour:Minute Format
        style = "fg:${timeFG} bg:${timeBG}";
        format = "[ $time]($style)";
      };
    };
  };
}