#!/bin/bash
#########################################################
# 							#
# This is BashStyle-NG  				#
#							#
# Licensed under GNU GENERAL PUBLIC LICENSE v3    	#
#							#
# Copyright 2007 - 2015 Christopher Bratusek		#
#							#
#########################################################

enable_colors=True

dbg_msg $"BashStyle-NG Setting:" $"Colors" $"On"
dbg_msg $"BashStyle-NG Setting:" $"Color-Style" $(ini_get color_style)

colstyle=$(ini_get color_style)

if [[ $colstyle == bright ]]; then
	style="01"
elif [[ $colstyle == normal ]]; then
	style="0"
elif [[ $colstyle == inverted ]]; then
	style="7"
elif [[ $colstyle == dimmed ]]; then
	style="02"
elif [[ $colstyle == underlined ]]; then
	style="04"
fi

if [[ $TERM != *xterm* ]]; then
	black="\[\033[${style};30m\]"
	red="\[\033[${style};31m\]"
	green="\[\033[${style};32m\]"
	yellow="\[\033[${style};33m\]"
	blue="\[\033[${style};34m\]"
	magenta="\[\033[${style};35m\]"
	cyan="\[\033[${style};36m\]"
	white="\[\033[${style};37m\]"
	coldblue=$blue
	smoothblue=$blue
	iceblue=$blue
	turqoise=$cyan
	smoothgreen=$green
	winered=$red
	brown=$yellow
	silver=$white
	ocher=$yellow
	orange=$yellow
	purple=$magenta
	pink=$magenta
	cream=$magenta

	eblack="\033[${style};30m"
	ered="\033[${style};31m"
	egreen="\033[${style};32m"
	eyellow="\033[${style};33m"
	eblue="\033[${style};34m"
	emagenta="\033[${style};35m"
	ecyan="\033[${style};36m"
	ewhite="\033[${style};37m"
	ecoldblue=$eblue
	esmoothblue=$eblue
	eiceblue=$eblue
	eturqoise=$ecyan
	esmoothgreen=$egreen
	ewinered=$ered
	ebrown=$eyellow
	esilver=$ewhite
	eocher=$eyellow
	eorange=$eyellow
	epurple=$emagenta
	epink=$emagenta
	ecream=$emagenta
else
	black="\[\033[${style};38;5;0m\]"
	red="\[\033[${style};38;5;1m\]"
	green="\[\033[${style};38;5;2m\]"
	yellow="\[\033[${style};38;5;3m\]"
	blue="\[\033[${style};38;5;4m\]"
	magenta="\[\033[${style};38;5;129m\]"
	cyan="\[\033[${style};38;5;6m\]"
	white="\[\033[${style};38;5;7m\]"
	coldblue="\[\033[${style};38;5;33m\]"
	smoothblue="\[\033[${style};38;5;111m\]"
	iceblue="\[\033[${style};38;5;45m\]"
	turqoise="\[\033[${style};38;5;50m\]"
	smoothgreen="\[\033[${style};38;5;42m\]"
	winered="\[\033[${style};38;5;637m\]"
	brown="\[\033[${style};38;5;684m\]"
	silver="\[\033[${style};38;5;761m\]"
	ocher="\[\033[${style};38;5;690m\]"
	orange="\[\033[${style};38;5;714m\]"
	purple="\[\033[${style};38;5;604m\]"
	pink="\[\033[${style};38;5;213m\]"
	cream="\[\033[${style};38;5;5344m\]"

	eblack="\033[${style};38;5;0m"
	ered="\033[${style};38;5;1m"
	egreen="\033[${style};38;5;2m"
	eyellow="\033[${style};38;5;3m"
	eblue="\033[${style};38;5;4m"
	emagenta="\033[${style};38;5;129m"
	ecyan="\033[${style};38;5;6m"
	ewhite="\033[${style};38;5;7m"
	ecoldblue="\033[${style};38;5;33m"
	esmoothblue="\033[${style};38;5;111m"
	eiceblue="\033[${style};38;5;45m"
	eturqoise="\033[${style};38;5;50m"
	esmoothgreen="\033[${style};38;5;42m"
	ewinered="\033[${style};38;5;637m"
	ebrown="\033[${style};38;5;684m"
	esilver="\033[${style};38;5;761m"
	eocher="\033[${style};38;5;690m"
	eorange="\033[${style};38;5;714m"
	epurple="\033[${style};38;5;604m"
	epink="\033[${style};38;5;213m"
	ecream="\033[${style};38;5;5344m"
fi

eval usercolor=$(ini_get color_user)
eval hostcolor=$(ini_get color_host)
eval datecolor=$(ini_get color_date)
eval timecolor=$(ini_get color_time)
eval wdircolor=$(ini_get color_wdir)
eval fontcolor=$(ini_get color_font)
eval sepacolor=$(ini_get color_separator)
eval upcolor=$(ini_get color_uptime)
eval pscolor=$(ini_get color_ps234)

eusercolor=$(echo ${usercolor}| sed -e 's/\\\[//g;s/\\\]//g')
ehostcolor=$(echo ${hostcolor} | sed -e 's/\\\[//g;s/\\\]//g')
edatecolor=$(echo ${datecolor} | sed -e 's/\\\[//g;s/\\\]//g')
etimecolor=$(echo ${timecolor} | sed -e 's/\\\[//g;s/\\\]//g')
ewdircolor=$(echo ${wdircolor} | sed -e 's/\\\[//g;s/\\\]//g')
efontcolor=$(echo ${fontcolor} | sed -e 's/\\\[//g;s/\\\]//g')
esepacolor=$(echo ${sepacolor} | sed -e 's/\\\[//g;s/\\\]//g')
eupcolor=$(echo ${upcolor} | sed -e 's/\\\[//g;s/\\\]//g')
epscolor=$(echo ${pscolor} | sed -e 's/\\\[//g;s/\\\]//g')
