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

dbg_msg $"BashStyle-NG Setting:" LS_COLORS

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

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

if bt $(ini_get dark_terminal); then
	lblack=${lwhite}
else	lwhite=${lblack}
fi

lscolors=(exec generic logs deb rpm dirs jpeg png gif mp3 ogg flac tar targz
tarbz2 tarxz zip rar link socket pipe blockdev chardev)

for lscolor in "${lscolors[@]}"; do
	eval "_${lscolor}"=$(ini_get "${lscolor}")
done

_custom="$(ini_get custom)"

dbg_log export LS_COLORS="*=${_generic}:ex=${_exec}:*.log=${_logs}:*.deb=${_deb}:\
*.rpm=${_rpm}:di=${_dirs}:*.jpg=${_jpeg}:*.jpeg=${_jpeg}:*.png=${_png}:*.gif=${_gif}:\
*.mp3=${_mp3}:*.ogg=${_ogg}:*.flac=${_flac}:*.tar=${_tar}:*.tar.gz=${_targz}:\
*.tgz=${_targz}:*.tar.bz2=${_tarbz2}:*.tbz=${_tarbz2}:*.tar.xz=${_tarxz}:\
*.zip=${_zip}:*.rar=${_rar}:ln=${_link}:so=${_socket}:pi=${_pipe}:bd=${_blockdev}:\
cd=${_chardev}:${_custom}"

dbg_msg $"LS_COLORS Setting:" LS_COLORS "${LS_COLORS}"

for lscolor in "${lscolors[@]}"; do
	eval unset "_${lscolor}"
done

unset _custom
