From f1fcc8dfb0106abad4d11e88e09f0180aad4149e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 11 Jan 2011 10:21:26 +0000 Subject: color border limits are now constants --- loadbars.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/loadbars.pl b/loadbars.pl index e6f1ad3..41f8c44 100755 --- a/loadbars.pl +++ b/loadbars.pl @@ -67,6 +67,11 @@ use constant { WHITE => SDL::Color->new(-r => 0xff, -g => 0xff, -b => 0xff), YELLOW0 => SDL::Color->new(-r => 0xff, -g => 0xa0, -b => 0x00), YELLOW => SDL::Color->new(-r => 0xff, -g => 0xc0, -b => 0x00), + SYSTEM_PURPLE => 30, + USER_WHITE => 99, + USER_RED => 90, + USER_ORANGE => 70, + USER_YELLOW0 => 50, }; $| = 1; @@ -329,13 +334,13 @@ sub graph_stats ($) { $app->fill($rect_iowait, BLACK); $app->fill($rect_nice, GREEN); $app->fill($rect_system, BLUE); - $app->fill($rect_system, $load_average{system} > 30 + $app->fill($rect_system, $load_average{system} > SYSTEM_PURPLE ? PURPLE : BLUE); - $app->fill($rect_user, $system_n_user > 99 ? WHITE - : ($system_n_user > 90 ? RED - : ($system_n_user > 70 ? ORANGE - : ($system_n_user > 50 ? YELLOW0 + $app->fill($rect_user, $system_n_user > USER_WHITE ? WHITE + : ($system_n_user > USER_RED ? RED + : ($system_n_user > USER_ORANGE ? ORANGE + : ($system_n_user > USER_YELLOW0 ? YELLOW0 : (YELLOW))))); $app->update($_) for $rect_nice, $rect_iowait, $rect_system, $rect_user; -- cgit v1.2.3