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

case $1 in
	"" | 1)
		load=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\1/" -e "s/ //g")
	;;
	
	2 | 10)
		load=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\2/" -e "s/ //g")
	;;
	
	3 | 15)
		load=$(uptime | sed -e "s/.*load average: \(.*\...\), \(.*\...\), \(.*\...\)/\3/" -e "s/ //g")
	;;
esac

tmp=$(echo $load*100 | bc)
load100=${tmp%.*}

if [[ $enabcol == true ]]; then

if [[ ${load100} -lt 35 ]]
then
  loadcolor=$(bs-ng-parse-echo $blue)
elif [[ ${load100} -ge 35 ]] && [[ ${load100} -lt 120 ]]
then
  loadcolor=$(bs-ng-parse-echo $iceblue)
elif [[ ${load100} -ge 120 ]] && [[ ${load100} -lt 200 ]]
then
  loadcolor=$(bs-ng-parse-echo $green)
elif [[ ${load100} -ge 200 ]] && [[ ${load100} -lt 300 ]]
then
  loadcolor=$(bs-ng-parse-echo $yellow)
else
  loadcolor=$(bs-ng-parse-echo $red)
fi

fi

echo -e $loadcolor$load
