# Generated from palette.json by generate.py. Do not edit directly.
# Rider-colored bash prompt using the shared palette.

# shellcheck shell=bash

if [ -r "$HOME/.config/rider-palette/palette.sh" ]; then
  . "$HOME/.config/rider-palette/palette.sh"
fi

rider_fg() {
  local hex="${1#\#}"
  printf '\[\033[38;2;%d;%d;%dm\]' "$((16#${hex:0:2}))" "$((16#${hex:2:2}))" "$((16#${hex:4:2}))"
}

RIDER_RESET='\[\033[0m\]'

__rider_git_branch() {
  command -v git >/dev/null 2>&1 || return 0
  git rev-parse --is-inside-work-tree >/dev/null 2>&1 || return 0

  local branch
  branch="$(git symbolic-ref --quiet --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)" || return 0
  [ -n "$branch" ] || return 0

  printf ' %sgit:%s%s' "$(rider_fg "$RIDER_FUNC")" "$branch" "$RIDER_RESET"
}

__rider_set_bash_prompt() {
  PS1="${debian_chroot:+($debian_chroot)}$(rider_fg "$RIDER_FG_BRIGHT")\u@\h${RIDER_RESET}$(rider_fg "$RIDER_BORDER"):$(rider_fg "$RIDER_KEYWORD")\w${RIDER_RESET}$(__rider_git_branch)$(rider_fg "$RIDER_BORDER") \\$ ${RIDER_RESET}"
}

PROMPT_COMMAND=__rider_set_bash_prompt
