#!/bin/bash
#########################################################
#                                                       #
# This is BashStyle-NG                                  #
#                                                       #
# Licensed under GNU GENERAL PUBLIC LICENSE v3          #
#                                                       #
# Copyright Christopher Roy Bratušek                    #
#                                                       #
#########################################################

bashstyle_colorshell () {
    [[ ${BSNG_BASHVER} -ge 44 ]] && local OLD_PS0="${PS0}"
    local OLD_PS1="${PS1}"
    local OLD_PS2="${PS2}"
    local OLD_PS3="${PS3}"
    local OLD_PS4="${PS4}"

    # exclude black (0) on dark terminal
    # exclude white (7) on bright terminal
    if [[ "${BSNG_TERMINAL_DARK}" == True ]]; then
            randomcolor=$(random -r 1 7)
    else    randomcolor=$(random -r 0 6)
    fi

    cmd_text_colour='\[`tput setaf ${randomcolor}`\]'

    shopt -s promptvars

    [[ ${BSNG_BASHVER} -ge 44 ]] && PS0="${OLD_PS0}${cmd_text_colour}"
    PS1="${OLD_PS1}${cmd_text_colour}"
    PS2="${OLD_PS2}${cmd_text_colour}"
    PS3="${OLD_PS3}${cmd_text_colour}"
    PS4="${OLD_PS4}${cmd_text_colour}"
}

bashstyle_colorshell_reset () {
    echo -ne "\e[0m"
}
