#!/usr/bin/env bash
# https://github.com/dandavison/delta#get-started
# https://dandavison.github.io/delta/
#
# delta - A syntax-highlighting pager for git, diff, and grep output

# sudo apt-get install -y git-delta
sudo apt-get install -y ansifilter

# Upstream releases deb files
#
DEST=${1:-/etc/skel}

GITUSER=dandavison
PROJECT=delta
LATEST_RELEASE_URL="https://api.github.com/repos/${GITUSER}/${PROJECT}/releases/latest"
ARCH=$(dpkg --print-architecture)

# Fetch the latest release tag
TAG=$(torsocks curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "${LATEST_RELEASE_URL}" | jq -r '.tag_name')

# Download the.deb file and its SHA256 checksum
# test for ARCH to select the correct file to download
case $ARCH in
amd64)
  EXTENSION="amd64.deb"
  ;;
arm64)
  EXTENSION="arm64.deb"
  ;;
armhf)
  EXTENSION="armhf.deb"
  ;;
*)
  echo "Unable to determine system architecture."
  exit 1
  ;;
esac

wget -c -O /tmp/${PROJECT}_${TAG}_${EXTENSION} https://github.com/${GITUSER}/${PROJECT}/releases/download/${TAG}/git-${PROJECT}_${TAG}_${EXTENSION}
wget -c -O /tmp/${PROJECT}_${TAG}_${EXTENSION}.sha256 https://github.com/${GITUSER}/${PROJECT}/releases/download/${TAG}/git-${PROJECT}_${TAG}_${EXTENSION}.sha256

# Verify the checksum using sha256sum --check
sha256sum --check /tmp/${PROJECT}_${TAG}.${EXTENSION}.sha256

# no sha available.
sudo dpkg -i /tmp/${PROJECT}_${TAG}_${EXTENSION}
sudo apt-get -f install

## If the checksum verification is successful, install the.deb file using dpkg
#if [ $? -eq 0 ]; then
#  sudo dpkg -i /tmp/${PROJECT}_${TAG}_${EXTENSION}
#  sudo apt-get -f install
#else
#  echo "Checksums do not match. Skipping installation."
#fi

echo " minimal example dot gitconfig"
conf_print_gitconfig() {
  cat <<-EOF
    [core]
        pager = delta

    [interactive]
        diffFilter = delta --color-only

    [include]
        path = ${DEST}/.config/delta/themes.gitconfig

    [delta]
        navigate = true    # use n and N to move between diff sections
        features = mellow-barbets side-by-side line-numbers decorations
        side-by-side = true

        # delta detects terminal colors automatically; set one of these to disable auto-detection
        # dark = true
        # light = true

    [merge]
        conflictstyle = diff3

    [diff]
        colorMoved = default
	EOF
}

# used in screenshots
echo "Another example dot gitconfig as used in the git repo screenshots: "
conf_print_gitconfig() {
  cat <<-EOF
  [delta]
    features = side-by-side line-numbers decorations
    syntax-theme = Dracula
    plus-style = syntax "#003800"
    minus-style = syntax "#3f0001"

  [delta "decorations"]
      commit-decoration-style = bold yellow box ul
      file-style = bold yellow ul
      file-decoration-style = none
      hunk-header-decoration-style = cyan box ul

  [delta "line-numbers"]
      line-numbers-left-style = cyan
      line-numbers-right-style = cyan
      line-numbers-minus-style = 124
      line-numbers-plus-style = 28
EOF
}

# We have many other settings in our .gitconfiug so don't want to squash it.
echo "Here is an example of the changes to make to your .gitconfig to enable git-delta as your pager."
conf_print_gitconfig

# if [[ -f ${DEST}/.gitconfig.bak ]]; then
#   mv ${DEST}/.gitconfig.bak ${DEST}/.gitconfig.bak_old
#   mv ${DEST}/.gitconfig ${DEST}/.gitconfig.bak
#   conf_print_gitconfig | tee ${DEST}/.gitconfig
# elif [[ -f ${DEST}/.gitconfig ]]; then
#   mv ${DEST}/.gitconfig ${DEST}/.gitconfig.bak
#   conf_print_gitconfig | tee ${DEST}/.gitconfig
# else
#   conf_print_gitconfig | tee ${DEST}/.gitconfig
# fi

# completions
# delta --generate-completition zsh > /usr/share/zsh/vendor-completions/_delta

print_conf_delta-completitions() {
  cat <<'EOF'
#compdef delta

autoload -U is-at-least

_delta() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" \
'--blame-code-style=[Style string for the code section of a git blame line]:STYLE: ' \
'--blame-format=[Format string for git blame commit metadata]:FMT: ' \
'--blame-palette=[Background colors used for git blame lines (space-separated string)]:COLORS: ' \
'--blame-separator-format=[Separator between the blame format and the code section of a git blame line]:FMT: ' \
'--blame-separator-style=[Style string for the blame-separator-format]:STYLE: ' \
'--blame-timestamp-format=[Format of \`git blame\` timestamp in raw git output received by delta]:FMT: ' \
'--blame-timestamp-output-format=[Format string for git blame timestamp output]:FMT: ' \
'--config=[Load the config file at PATH instead of ~/.gitconfig]:PATH:_files' \
'--commit-decoration-style=[Style string for the commit hash decoration]:STYLE: ' \
'--commit-regex=[Regular expression used to identify the commit line when parsing git output]:REGEX: ' \
'--commit-style=[Style string for the commit hash line]:STYLE: ' \
'--default-language=[Default language used for syntax highlighting]:LANG: ' \
'--detect-dark-light=[Detect whether or not the terminal is dark or light by querying for its colors]:DETECT_DARK_LIGHT:((auto\:"Only query the terminal for its colors if the output is not redirected"
always\:"Always query the terminal for its colors"
never\:"Never query the terminal for its colors"))' \
'-@+[Extra arguments to pass to \`git diff\` when using delta to diff two files]:STRING: ' \
'--diff-args=[Extra arguments to pass to \`git diff\` when using delta to diff two files]:STRING: ' \
'--diff-stat-align-width=[Width allocated for file paths in a diff stat section]:N: ' \
'--features=[Names of delta features to activate (space-separated)]:FEATURES: ' \
'--file-added-label=[Text to display before an added file path]:STRING: ' \
'--file-copied-label=[Text to display before a copied file path]:STRING: ' \
'--file-decoration-style=[Style string for the file decoration]:STYLE: ' \
'--file-modified-label=[Text to display before a modified file path]:STRING: ' \
'--file-removed-label=[Text to display before a removed file path]:STRING: ' \
'--file-renamed-label=[Text to display before a renamed file path]:STRING: ' \
'--file-style=[Style string for the file section]:STYLE: ' \
'--file-transformation=[Sed-style command transforming file paths for display]:SED_CMD: ' \
'--generate-completion=[Print completion file for the given shell]:GENERATE_COMPLETION:(bash elvish fish powershell zsh)' \
'--grep-context-line-style=[Style string for non-matching lines of grep output]:STYLE: ' \
'--grep-file-style=[Style string for file paths in grep output]:STYLE: ' \
'--grep-header-decoration-style=[Style string for the header decoration in grep output]:STYLE: ' \
'--grep-header-file-style=[Style string for the file path part of the header in grep output]:STYLE: ' \
'--grep-line-number-style=[Style string for line numbers in grep output]:STYLE: ' \
'--grep-output-type=[Grep output format. Possible values\: "ripgrep" - file name printed once, followed by matching lines within that file, each preceded by a line number. "classic" - file name\:line number, followed by matching line. Default is "ripgrep" if \`rg --json\` format is detected, otherwise "classic"]:OUTPUT_TYPE:(ripgrep classic)' \
'--grep-match-line-style=[Style string for matching lines of grep output]:STYLE: ' \
'--grep-match-word-style=[Style string for the matching substrings within a matching line of grep output]:STYLE: ' \
'--grep-separator-symbol=[Separator symbol printed after the file path and line number in grep output]:STRING: ' \
'--hunk-header-decoration-style=[Style string for the hunk-header decoration]:STYLE: ' \
'--hunk-header-file-style=[Style string for the file path part of the hunk-header]:STYLE: ' \
'--hunk-header-line-number-style=[Style string for the line number part of the hunk-header]:STYLE: ' \
'--hunk-header-style=[Style string for the hunk-header]:STYLE: ' \
'--hunk-label=[Text to display before a hunk header]:STRING: ' \
'--hyperlinks-commit-link-format=[Format string for commit hyperlinks (requires --hyperlinks)]:FMT: ' \
'--hyperlinks-file-link-format=[Format string for file hyperlinks (requires --hyperlinks)]:FMT: ' \
'--inline-hint-style=[Style string for short inline hint text]:STYLE: ' \
'--inspect-raw-lines=[Kill-switch for --color-moved support]:true|false:(true false)' \
'--line-buffer-size=[Size of internal line buffer]:N: ' \
'--line-fill-method=[Line-fill method in side-by-side mode]:STRING:(ansi spaces)' \
'--line-numbers-left-format=[Format string for the left column of line numbers]:FMT: ' \
'--line-numbers-left-style=[Style string for the left column of line numbers]:STYLE: ' \
'--line-numbers-minus-style=[Style string for line numbers in the old (minus) version of the file]:STYLE: ' \
'--line-numbers-plus-style=[Style string for line numbers in the new (plus) version of the file]:STYLE: ' \
'--line-numbers-right-format=[Format string for the right column of line numbers]:FMT: ' \
'--line-numbers-right-style=[Style string for the right column of line numbers]:STYLE: ' \
'--line-numbers-zero-style=[Style string for line numbers in unchanged (zero) lines]:STYLE: ' \
'--map-styles=[Map styles encountered in raw input to desired output styles]:STYLES_MAP: ' \
'--max-line-distance=[Maximum line pair distance parameter in within-line diff algorithm]:DIST: ' \
'--max-syntax-highlighting-length=[Stop syntax highlighting lines after this many characters]:N: ' \
'--max-line-length=[Truncate lines longer than this]:N: ' \
'--merge-conflict-begin-symbol=[String marking the beginning of a merge conflict region]:STRING: ' \
'--merge-conflict-end-symbol=[String marking the end of a merge conflict region]:STRING: ' \
'--merge-conflict-ours-diff-header-decoration-style=[Style string for the decoration of the header above the '\''ours'\'' merge conflict diff]:STYLE: ' \
'--merge-conflict-ours-diff-header-style=[Style string for the header above the '\''ours'\'' branch merge conflict diff]:STYLE: ' \
'--merge-conflict-theirs-diff-header-decoration-style=[Style string for the decoration of the header above the '\''theirs'\'' merge conflict diff]:STYLE: ' \
'--merge-conflict-theirs-diff-header-style=[Style string for the header above the '\''theirs'\'' branch merge conflict diff]:STYLE: ' \
'--minus-empty-line-marker-style=[Style string for removed empty line marker]:STYLE: ' \
'--minus-emph-style=[Style string for emphasized sections of removed lines]:STYLE: ' \
'--minus-non-emph-style=[Style string for non-emphasized sections of removed lines that have an emphasized section]:STYLE: ' \
'--minus-style=[Style string for removed lines]:STYLE: ' \
'--navigate-regex=[Regular expression defining navigation stop points]:REGEX: ' \
'--pager=[Which pager to use]:CMD: ' \
'--paging=[Whether to use a pager when displaying output]:auto|always|never:(auto always never)' \
'--plus-emph-style=[Style string for emphasized sections of added lines]:STYLE: ' \
'--plus-empty-line-marker-style=[Style string for added empty line marker]:STYLE: ' \
'--plus-non-emph-style=[Style string for non-emphasized sections of added lines that have an emphasized section]:STYLE: ' \
'--plus-style=[Style string for added lines]:STYLE: ' \
'--right-arrow=[Text to display with a changed file path]:STRING: ' \
'--syntax-theme=[The syntax-highlighting theme to use]:SYNTAX_THEME: ' \
'--tabs=[The number of spaces to replace tab characters with]:N: ' \
'--true-color=[Whether to emit 24-bit ("true color") RGB color codes]:auto|always|never:(auto always never)' \
'--whitespace-error-style=[Style string for whitespace errors]:STYLE: ' \
'-w+[The width of underline/overline decorations]:N: ' \
'--width=[The width of underline/overline decorations]:N: ' \
'--word-diff-regex=[Regular expression defining a '\''word'\'' in within-line diff algorithm]:REGEX: ' \
'--wrap-left-symbol=[End-of-line wrapped content symbol (left-aligned)]:STRING: ' \
'--wrap-max-lines=[How often a line should be wrapped if it does not fit]:N: ' \
'--wrap-right-percent=[Threshold for right-aligning wrapped content]:PERCENT: ' \
'--wrap-right-prefix-symbol=[Pre-wrapped content symbol (right-aligned)]:STRING: ' \
'--wrap-right-symbol=[End-of-line wrapped content symbol (right-aligned)]:STRING: ' \
'--zero-style=[Style string for unchanged lines]:STYLE: ' \
'--24-bit-color=[Deprecated\: use --true-color]:auto|always|never:(auto always never)' \
'--color-only[Do not alter the input structurally in any way]' \
'--dark[Use default colors appropriate for a dark terminal background]' \
'--diff-highlight[Emulate diff-highlight]' \
'--diff-so-fancy[Emulate diff-so-fancy]' \
'--hyperlinks[Render commit hashes, file names, and line numbers as hyperlinks]' \
'--keep-plus-minus-markers[Prefix added/removed lines with a +/- character, as git does]' \
'--light[Use default colors appropriate for a light terminal background]' \
'-n[Display line numbers next to the diff]' \
'--line-numbers[Display line numbers next to the diff]' \
'--list-languages[List supported languages and associated file extensions]' \
'--list-syntax-themes[List available syntax-highlighting color themes]' \
'--navigate[Activate diff navigation]' \
'--no-gitconfig[Do not read any settings from git config]' \
'--parse-ansi[Display ANSI color escape sequences in human-readable form]' \
'--raw[Do not alter the input in any way]' \
'--relative-paths[Output all file paths relative to the current directory]' \
'--show-colors[Show available named colors]' \
'--show-config[Display the active values for all Delta options]' \
'--show-syntax-themes[Show example diff for available syntax-highlighting themes]' \
'--show-themes[Show example diff for available delta themes]' \
'-s[Display diffs in side-by-side layout]' \
'--side-by-side[Display diffs in side-by-side layout]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
'::minus_file -- First file to be compared when delta is being used to diff two files:_files' \
'::plus_file -- Second file to be compared when delta is being used to diff two files:_files' \
&& ret=0
}

(( $+functions[_delta_commands] )) ||
_delta_commands() {
    local commands; commands=()
    _describe -t commands 'delta commands' commands "$@"
}

if [ "$funcstack[1]" = "_delta" ]; then
    _delta "$@"
else
    compdef _delta delta
fi
EOF
}
conf_print_delta-completions | sudo tee /usr/share/zsh/vendor-completions/_delta

mkdir -p ${DEST}/.config/delta
wget -c -O ${DEST}/.config/delta/themes.gitconfig https://github.com/dandavison/delta/raw/main/themes.gitconfig
conf_print_delta_themes() {
  cat <<-EOF
  # To use these themes, first include this file in your own gitconfig file:
  #
  # [include]
  #     path = PATH/TO/delta/themes.gitconfig
  #
  # Then, in your own gitconfig file, activate the chosen theme, e.g.
  #
  # [delta]
  #    features = kingfisher
  #
  # Please add your own themes to this file, and open a PR.
  #
  # Instructions:
  #
  # 1. The name of the theme must be the name of some sort of wild organism:
  #    mammal, bird, plant, mollusk -- whatever. It can be in any language.
  #
  # 2. Use `delta --show-config` to list all the style settings that are active in
  #    your current delta environment, but only include settings in your theme
  #    that are essential to its appearance.
  #
  # 3. Include either `dark = true` or `light = true` according to whether it is
  #    designed for a light or dark terminal background. (This marks a feature as
  #    a "theme", causing it to be picked up by `delta --show-themes`).
  #
  # 4. Feel free to include a comment line indicating who is the author of the
  #    theme. E.g. a link to your github user page.

  [delta "colibri"]
      # author: https://github.com/pablospe
      # Based on woolly-mammoth: https://github.com/Kr1ss-XD.
      commit-decoration-style = 130 box
      dark = true
      file-decoration-style = "#606018" overline
      file-added-label = [●]
      file-copied-label = [C]
      file-modified-label = [+]
      file-removed-label = [⛌]
      file-renamed-label = [→]
      file-style = 232 bold 184
      hunk-header-style = syntax bold italic 237
      line-numbers = true
      line-numbers-left-format = "{nm:>1}┊"
      line-numbers-left-style = red
      line-numbers-minus-style = red bold
      line-numbers-plus-style = green bold
      line-numbers-right-format = " {np:>1}┊"
      line-numbers-right-style = green
      line-numbers-zero-style = "#545474" italic
      minus-emph-style = normal "#80002a"
      minus-style = normal "#5e0000"
      plus-emph-style = syntax bold "#007e5e"
      plus-style = syntax "#003500"
      syntax-theme = OneHalfDark
      whitespace-error-style = "#80002a" reverse
      zero-style = syntax
      blame-format = "{author:<18} ({commit:>7}) ┊{timestamp:^16}┊ "

  [delta "collared-trogon"]
      # author: https://github.com/clnoll
      commit-decoration-style = bold box ul
      dark = true
      file-decoration-style = none
      file-style = omit
      hunk-header-decoration-style = "#022b45" box ul
      hunk-header-file-style = "#999999"
      hunk-header-line-number-style = bold "#003300"
      hunk-header-style = file line-number syntax
      line-numbers = true
      line-numbers-left-style = "#022b45"
      line-numbers-minus-style = "#80002a"
      line-numbers-plus-style = "#003300"
      line-numbers-right-style = "#022b45"
      line-numbers-zero-style = "#999999"
      minus-emph-style = normal "#80002a"
      minus-style = normal "#330011"
      plus-emph-style = syntax "#003300"
      plus-style = syntax "#001a00"
      syntax-theme = Nord

  [delta "coracias-caudatus"]
      # author: https://github.com/clnoll
      commit-decoration-style = ol "#7536ff"
      commit-style = "#200078"
      file-decoration-style = none
      file-style = omit
      hunk-header-decoration-style = "#cfd6ff" ul
      hunk-header-file-style = "#858dff"
      hunk-header-line-number-style = "#7536ff"
      hunk-header-style = file line-number syntax
      light = true
      line-numbers = true
      line-numbers-left-format = "{nm:>4} ."
      line-numbers-left-style = "#e3ab02"
      line-numbers-minus-style = "#ff38b6"
      line-numbers-plus-style = "#00e0c2"
      line-numbers-right-format = "{np:>4}  "
      line-numbers-right-style = white
      line-numbers-zero-style = "#cccccc"
      minus-emph-style = bold "#ff3838" "#ffe3f7"
      minus-style = "#ff0080"
      plus-emph-style = "#008a81" bold "#00ffbf"
      plus-style = syntax "#cffff3"
      syntax-theme = GitHub

  [delta "hoopoe"]
      # author: https://github.com/dandavison
      light = true
      pink = "#ffe0e0"
      dark-pink = "#ffc0c0"
      green = "#d0ffd0"
      dark-green = "#a0efa0"
      dark-green-2 = "#067a00"
      minus-style = normal hoopoe.pink
      minus-emph-style = normal hoopoe.dark-pink
      minus-non-emph-style = minus-style
      plus-style = syntax hoopoe.green
      plus-emph-style = syntax hoopoe.dark-green
      plus-non-emph-style = plus-style
      minus-empty-line-marker-style = minus-style
      plus-empty-line-marker-style = plus-style
      commit-decoration-style = blue ol
      commit-style = raw
      file-style = omit
      hunk-header-decoration-style = blue box
      hunk-header-file-style = red
      hunk-header-line-number-style = hoopoe.dark-green-2
      hunk-header-style = file line-number syntax
      syntax-theme = GitHub
      zero-style = syntax

  [delta "tangara-chilensis"]
      # author: https://github.com/clnoll
      commit-decoration-style = bold box ul "#34fd50"
      dark = true
      file-decoration-style = none
      file-style = omit
      hunk-header-decoration-style = "#00b494" box ul
      hunk-header-file-style = "#999999"
      hunk-header-line-number-style = bold "#03a4ff"
      hunk-header-style = file line-number syntax
      line-numbers = true
      line-numbers-left-style = black
      line-numbers-minus-style = "#B10036"
      line-numbers-plus-style = "#03a4ff"
      line-numbers-right-style = black
      line-numbers-zero-style = "#999999"
      minus-emph-style = normal "#de004e"
      minus-style = normal "#990017"
      plus-emph-style = syntax "#03a4ff"
      plus-style = syntax "#450eff"
      side-by-side = true
      syntax-theme = Vibrant Sunburst

  [delta "villsau"]
      # author: https://github.com/torarnv
      dark = true
      file-style = omit
      hunk-header-decoration-style = omit
      hunk-header-file-style = magenta
      hunk-header-line-number-style = dim magenta
      hunk-header-style = file line-number syntax
      line-numbers = false
      minus-emph-style = bold red 52
      minus-empty-line-marker-style = normal "#3f0001"
      minus-non-emph-style = dim red
      minus-style = bold red
      plus-emph-style = bold green 22
      plus-empty-line-marker-style = normal "#002800"
      plus-non-emph-style = dim green
      plus-style = bold green
      syntax-theme = OneHalfDark
      whitespace-error-style = reverse red
      zero-style = dim syntax

  [delta "woolly-mammoth"]
      # author: https://github.com/Kr1ss-XD
      commit-decoration-style = 232 130 box
      commit-style = 232 bold italic 130
      dark = true
      file-added-label = [+]
      file-copied-label = [C]
      file-decoration-style = "#606018" overline
      file-modified-label = [M]
      file-removed-label = [-]
      file-renamed-label = [R]
      file-style = 232 bold 184
      hunk-header-decoration-style = none
      hunk-header-style = syntax bold italic 237
      line-numbers = true
      line-numbers-left-format = "{nm:>1}┊"
      line-numbers-left-style = red
      line-numbers-minus-style = red italic black
      line-numbers-plus-style = green italic black
      line-numbers-right-format = "{np:>1}┊"
      line-numbers-right-style = green
      line-numbers-zero-style = "#545474" italic
      minus-emph-style = syntax bold "#780000"
      minus-style = syntax "#400000"
      plus-emph-style = syntax bold "#007800"
      plus-style = syntax "#004000"
      syntax-theme = Vibrant Sunburst
      whitespace-error-style = "#280050" reverse
      zero-style = syntax
      blame-format = "{author:<18} ({commit:>7}) ┊{timestamp:^16}┊ "
      blame-palette = "#101010 #200020 #002800 #000028 #202000 #280000 #002020 #002800 #202020"

  [delta "calochortus-lyallii"]
      # author: https://github.com/manojkarthick
      commit-decoration-style = none
      dark = true
      file-added-label = [+]
      file-copied-label = [C]
      file-decoration-style = none
      file-modified-label = [M]
      file-removed-label = [-]
      file-renamed-label = [R]
      file-style = 232 bold 184
      hunk-header-decoration-style = none
      hunk-header-file-style = "#999999"
      hunk-header-line-number-style = bold "#03a4ff"
      hunk-header-style = file line-number syntax
      line-numbers = true
      line-numbers-left-style = black
      line-numbers-minus-style = "#B10036"
      line-numbers-plus-style = "#03a4ff"
      line-numbers-right-style = black
      line-numbers-zero-style = "#999999"
      minus-emph-style = syntax bold "#780000"
      minus-style = syntax "#400000"
      plus-emph-style = syntax bold "#007800"
      plus-style = syntax "#004000"
      whitespace-error-style = "#280050" reverse
      zero-style = syntax
      syntax-theme = Nord

  [delta "mantis-shrimp"]
      #author: https://github.com/2kabhishek
      dark = true
      side-by-side = true
      keep-plus-minus-markers = true
      hyperlinks = true
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      file-style = omit
      zero-style = syntax
      syntax-theme = Monokai Extended
      commit-decoration-style ="#11ce16" box
      commit-style = "#ffd21a" bold italic
      hunk-header-decoration-style = "#1688f0" box ul
      hunk-header-file-style = "#c63bee" ul bold
      hunk-header-line-number-style = "#ffd21a" box bold
      hunk-header-style = file line-number syntax bold italic
      line-numbers = true
      line-numbers-left-format = "{nm:>1}|"
      line-numbers-left-style = "#1688f0"
      line-numbers-minus-style = "#ff0051" bold
      line-numbers-plus-style = "#03e57f" bold
      line-numbers-right-format = "{np:>1}|"
      line-numbers-right-style = "#1688f0"
      line-numbers-zero-style = "#aaaaaa" italic
      minus-emph-style = syntax bold "#b80000"
      minus-style = syntax "#5d001e"
      plus-emph-style = syntax bold "#007800"
      plus-style = syntax "#004433"
      whitespace-error-style = "#280050"

  [delta "mantis-shrimp-lite"]
      #author: https://github.com/2kabhishek
      dark = true
      side-by-side = true
      keep-plus-minus-markers = true
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      file-style = omit
      zero-style = syntax
      syntax-theme = Monokai Extended
      commit-decoration-style = green box
      commit-style = yellow bold italic
      hunk-header-decoration-style = blue box ul
      hunk-header-file-style = purple ul bold
      hunk-header-line-number-style = yellow box bold
      hunk-header-style = file line-number syntax bold italic
      line-numbers = true
      line-numbers-left-format = "{nm:>1}|"
      line-numbers-left-style = blue
      line-numbers-minus-style = red bold
      line-numbers-plus-style = green bold
      line-numbers-right-format = "{np:>1}|"
      line-numbers-right-style = blue
      line-numbers-zero-style = white italic
      minus-emph-style = syntax bold red
      plus-emph-style = syntax bold green
      whitespace-error-style = purple bold

  [delta "zebra-dark"]
      minus-style = syntax "#330f0f"
      minus-emph-style = syntax "#4f1917"
      plus-style = syntax "#0e2f19"
      plus-emph-style = syntax "#174525"
      map-styles = \
        bold purple => syntax "#330f29", \
        bold blue => syntax "#271344", \
        bold cyan => syntax "#0d3531", \
        bold yellow => syntax "#222f14"
      zero-style = syntax
      whitespace-error-style = "#aaaaaa"

  [delta "zebra-light"]
      minus-style = syntax "#fbdada"
      minus-emph-style = syntax "#f6b6b6"
      plus-style = syntax "#d6ffd6"
      plus-emph-style = syntax "#adffad"
      map-styles = \
        bold purple => syntax "#feecf7", \
        bold blue => syntax "#e5dff6", \
        bold cyan => syntax "#d8fdf6", \
        bold yellow => syntax "#f4ffe0"
      zero-style = syntax
      whitespace-error-style = "#aaaaaa"

  [delta "chameleon"]
      #author: https://github.com/AirOnSkin
      dark = true
      line-numbers = true
      side-by-side = true
      keep-plus-minus-markers = false
      syntax-theme = Nord
      file-style = "#434C5E" bold
      file-decoration-style = "#434C5E" ul
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      hunk-header-style = omit
      line-numbers-left-format = " {nm:>3} │"
      line-numbers-left-style = red
      line-numbers-right-format = " {np:>3} │"
      line-numbers-right-style = green
      line-numbers-minus-style = red italic black
      line-numbers-plus-style = green italic black
      line-numbers-zero-style = "#434C5E" italic
      minus-style = bold red
      minus-emph-style = bold "#202020" "#FF5555"
      minus-non-emph-style = bold
      plus-style = bold green
      plus-emph-style = bold "#202020" "#50FA7B"
      plus-non-emph-style = bold
      zero-style = syntax
      blame-code-style = syntax
      blame-format = "{author:<18} ({commit:>9}) {timestamp:^16}"
      blame-palette = "#2E3440" "#3B4252" "#434C5E" "#4C566A"
      merge-conflict-begin-symbol = ~
      merge-conflict-end-symbol = ~
      merge-conflict-ours-diff-header-style = "#F1FA8C" bold
      merge-conflict-ours-diff-header-decoration-style = "#434C5E" box
      merge-conflict-theirs-diff-header-style = "#F1FA8C" bold
      merge-conflict-theirs-diff-header-decoration-style = "#434C5E" box

  [delta "gruvmax-fang"]
      # author: https://github.com/maxfangx
      # General appearance
      dark = true
      syntax-theme = gruvbox-dark
      # File
      file-style = "#FFFFFF" bold
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      file-decoration-style = "#434C5E" ul
      file-decoration-style = "#84786A" ul
      # No hunk headers
      hunk-header-style = omit
      # Line numbers
      line-numbers = true
      line-numbers-left-style = "#84786A"
      line-numbers-right-style = "#84786A"
      line-numbers-minus-style = "#A02A11"
      line-numbers-plus-style = "#479B36"
      line-numbers-zero-style = "#84786A"
      line-numbers-left-format = " {nm:>3} │"
      line-numbers-right-format = " {np:>3} │"
      # Diff contents
      inline-hint-style = syntax
      minus-style = syntax "#330011"
      minus-emph-style = syntax "#80002a"
      minus-non-emph-style = syntax auto
      plus-style = syntax "#001a00"
      plus-emph-style = syntax "#003300"
      plus-non-emph-style = syntax auto
      whitespace-error-style = "#FB4934" reverse
      # Commit hash
      commit-decoration-style = normal box
      commit-style = "#ffffff" bold
      # Blame
      blame-code-style = syntax
      blame-format = "{author:>18} ({commit:>8}) {timestamp:<13} "
      blame-palette = "#000000" "#1d2021" "#282828" "#3c3836"
      # Merge conflicts
      merge-conflict-begin-symbol = ⌃
      merge-conflict-end-symbol = ⌄
      merge-conflict-ours-diff-header-style = "#FABD2F" bold
      merge-conflict-theirs-diff-header-style = "#FABD2F" bold overline
      merge-conflict-ours-diff-header-decoration-style = ''
      merge-conflict-theirs-diff-header-decoration-style = ''

  [delta "discord"]
      commit-style                  = omit
      file-style                    = 34 ul
      file-decoration-style         = none
      hunk-header-style             = omit
      minus-style                   = 31
      minus-non-emph-style          = 31
      minus-emph-style              = 40
      minus-empty-line-marker-style = 31
      zero-style                    = 30
      plus-style                    = 32
      plus-non-emph-style           = 32
      plus-emph-style               = 40
      grep-file-style               = 34
      grep-line-number-style        = 34
      whitespace-error-style        = 41
      blame-code-style              = omit
      true-color                    = never
      file-modified-label           = changed:
      right-arrow                   = >
      hyperlinks                    = false
      keep-plus-minus-markers       = true
      diff-stat-align-width         = 10
      syntax-theme                  = none
      width                         = variable

  [delta "mellow-barbet"]
      # author: https://github.com/kvrohit
      # To configure terminal colors see https://github.com/kvrohit/mellow.nvim#terminals
      dark = true
      syntax-theme = base16
      line-numbers = true
      side-by-side = true
      file-style = brightwhite
      file-decoration-style = none
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      hunk-header-decoration-style = "#3e3e43" box ul
      plus-style = brightgreen black
      plus-emph-style = black green
      minus-style = brightred black
      minus-emph-style = black red
      line-numbers-minus-style = brightred
      line-numbers-plus-style = brightgreen
      line-numbers-left-style = "#3e3e43"
      line-numbers-right-style = "#3e3e43"
      line-numbers-zero-style = "#57575f"
      zero-style = syntax
      whitespace-error-style = black bold
      blame-code-style = syntax
      blame-palette = "#161617" "#1b1b1d" "#2a2a2d" "#3e3e43"
      merge-conflict-begin-symbol = ~
      merge-conflict-end-symbol = ~
      merge-conflict-ours-diff-header-style = yellow bold
      merge-conflict-ours-diff-header-decoration-style = "#3e3e43" box
      merge-conflict-theirs-diff-header-style = yellow bold
      merge-conflict-theirs-diff-header-decoration-style = "#3e3e43" box

  [delta "arctic-fox"]
      # author: https://github.com/anthony-halim
      dark = true
      syntax-theme = Nord
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [*]
      file-removed-label = [-]
      file-renamed-label = [->]
      file-style = omit
      hunk-header-decoration-style = "#5E81AC" ul
      hunk-header-file-style = blue ul bold
      hunk-header-line-number-style = yellow box bold
      hunk-header-style = file line-number syntax bold italic
      plus-style = brightgreen
      plus-emph-style = black green
      minus-style = brightred
      minus-emph-style = black red
      line-numbers = true
      line-numbers-minus-style = brightred
      line-numbers-plus-style = brightgreen
      line-numbers-left-style = "#5E81AC"
      line-numbers-right-style = "#5E81AC"
      line-numbers-zero-style = "#4C566A"
      zero-style = syntax
      whitespace-error-style = black bold
      blame-code-style = syntax
      blame-format = "{author:<18} {commit:<6} {timestamp:<15}"
      blame-palette = "#2E3440" "#3B4252" "#434C5E"
      merge-conflict-begin-symbol = ~
      merge-conflict-end-symbol = ~
      merge-conflict-ours-diff-header-style = yellow bold
      merge-conflict-ours-diff-header-decoration-style = "#5E81AC" box
      merge-conflict-theirs-diff-header-style = yellow bold
      merge-conflict-theirs-diff-header-decoration-style = "#5E81AC" box

  [delta "corvus"]
      # author: https://github.com/evilwaveforms
      dark = true
      commit-style = "#949494"
      file-style = omit
      syntax-theme = none
      hunk-header-decoration-style = "#949494" ul
      hunk-header-file-style = "#949494"
      hunk-header-style = "#949494"
      line-numbers = true
      line-numbers-left-style = "#949494"
      line-numbers-right-style = "#949494"
      line-numbers-left-format = "{nm:>2}|"
      line-numbers-right-format = "{np:>3} "
      line-numbers-plus-style = "#54c047"
      line-numbers-minus-style = bold "#591102"
      plus-style = "#54c047"
      plus-emph-style = bold "#54c047"
      plus-non-emph-style = dim "#54c047"
      minus-style = normal "#591102"
      minus-emph-style = normal "#591102"
      minus-non-emph-style = bold "#591102"
      blame-code-style = omit
      blame-format = "{author:<18} {commit:<6} {timestamp:<15}"
      blame-palette = "#000000" "#343434"
      zero-style = dim

  [delta "platypus"]
      # Author: https://github.com/sarpuser
      dark = true
      side-by-side = true
      true-color = always
      file-added-label = [+]
      file-copied-label = [==]
      file-modified-label = [M]
      file-removed-label = [-]
      file-renamed-label = [->]
      file-style = "#ff9b00" ul bold
      file-decoration-style = "#ea00ff" box ul
      zero-style = syntax
      syntax-theme = Solarized (dark)
      commit-decoration-style ="#ea00ff" ul
      hunk-header-decoration-style = omit
      hunk-header-file-style = "#ff9b00" ul bold
      hunk-header-line-number-style = "#ffd21a" bold
      hunk-header-style = line-number syntax bold italic
      line-numbers = true
      line-numbers-left-format = "{nm:>1}|"
      line-numbers-left-style = "#ea00ff"
      line-numbers-minus-style = "#ff0051" bold
      line-numbers-plus-style = "#1ac71e" bold
      line-numbers-right-format = "{np:>1}|"
      line-numbers-right-style = "#ea00ff"
      line-numbers-zero-style = "#aaaaaa" italic
      minus-emph-style = syntax bold "#b80000"
      minus-style = syntax "#5d001e"
      plus-emph-style = syntax bold "#1a861a"
      plus-style = syntax "#2a5e37"
      whitespace-error-style = "#280050"
      wrap-max-lines = unlimited
      wrap-right-percent = 1
  EOF
}
conf_print_delta_themes | tee ${DEST}/.config/delta/themes.gitconfig
