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

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

lblack="${style};30"
lred="${style};31"
lgreen="${style};32"
lyellow="${style};33"
lblue="${style};34"
lmagenta="${style};35"
lcyan="${style};36"
lwhite="${style};37"

if [[ $TERM != *xterm* ]]; then

	lcoldblue=$lblue
	lsmoothblue=$lblue
	liceblue=$lblue
	lturqoise=$lcyan
	lsmoothgreen=$lgreen
	lwinered=$lred
	lbrown=$lyellow
	lsilver=$lwhite
	locher=$lyellow
	lorange=$lyellow
	lpurple=$lmagenta
	lpink=$lmagenta
	lcream=$lmagenta

else

	lcoldblue="${style};38;5;33"
	lsmoothblue="${style};38;5;111"
	liceblue="${style};38;5;45"
	lturqoise="${style};38;5;50"
	lsmoothgreen="${style};38;5;42"
	lwinered="${style};38;5;637"
	lbrown="${style};38;5;684"
	lsilver="${style};38;5;761"
	locher="${style};38;5;690"
	lorange="${style};38;5;714"
	lpurple="${style};38;5;604"
	lpink="${style};38;5;213"
	lcream="${style};38;5;5344"

fi

export lblack lred lgreen lyellow lblue lmagenta lcyan lwhite lcoldblue lsmoothblue liceblue lturqoise
export lsmoothgreen lwinered lbrown lsilver locher lorange lpurple lpink lcream

eval _exec=$(ini_get exec)
eval _gen=$(ini_get generic)
eval _log=$(ini_get logs)
eval _deb=$(ini_get deb)
eval _rpm=$(ini_get rpm)
eval _dirs=$(ini_get dirs)
eval _jpg=$(ini_get jpeg)
eval _png=$(ini_get png)
eval _gif=$(ini_get gif)
eval _mp3=$(ini_get mp3)
eval _ogg=$(ini_get ogg)
eval _flac=$(ini_get flac)
eval _tar=$(ini_get tar)
eval _targz=$(ini_get targz)
eval _tarbz2=$(ini_get tarbz2)
eval _zip=$(ini_get zip)
eval _rar=$(ini_get rar)

_custom="$(ini_get custom)"

dbg_log export LS_COLORS="ex=$_exec:*=$_gen:*.log=$_log:*.deb=$_deb:*.rpm=$_rpm:di=$_dirs:*.jpg=$_jpg:*.png=$_png:*.gif=$_gif:\
*.mp3=$_mp3:*.ogg=$_ogg:*.flac=$_flac:*.tar=$_tar:*.tar.gz=$_targz:*.tar.bz2=$_tarbz2:*.zip=$_zip:*.rar=$_rar:$_custom"

dbg_msg $"LS_COLORS Setting: LS_COLORS" "$LS_COLORS"
dbg_msg $"LS_COLORS Loading: BashStyle-NG"
