Skip to content

Commit

Permalink
Use red color if current capacity less than warning
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseR committed Sep 9, 2010
1 parent 6eade04 commit 979d5c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Battery.hs
Expand Up @@ -40,9 +40,10 @@ warn :: Double -> Bool
warn = (>) warning

bar :: Double -> [Color]
bar p = let green = truncate (p * (fromIntegral barstotal)) :: Int
yellow = barstotal - green :: Int
in (replicate green (Green barsymbol)) ++ (replicate yellow (Yellow barsymbol))
bar p = let greens = truncate (p * (fromIntegral barstotal)) :: Int
yellows = barstotal - greens :: Int
yellow = if warn p then Red else Yellow
in (replicate greens (Green barsymbol)) ++ (replicate yellows (yellow barsymbol))

printBar = do
f <- readFile full >>= return . read
Expand Down

0 comments on commit 979d5c6

Please sign in to comment.