changed meaning of 256-color flag to match the description

This commit is contained in:
Nicole Dresselhaus 2015-12-16 00:35:12 +01:00
parent d574d49f27
commit a4380981f2

View File

@ -37,7 +37,7 @@ main :: IO ()
main = execParser opthelp >>= run main = execParser opthelp >>= run
run :: Options -> IO () run :: Options -> IO ()
run (Options src w h c) = do run (Options src w h redcol) = do
src' <- if src == "-" then B.getContents else B.readFile src src' <- if src == "-" then B.getContents else B.readFile src
case decodeImage src' of case decodeImage src' of
Left err -> putStrLn err Left err -> putStrLn err
@ -45,7 +45,7 @@ run (Options src w h c) = do
case extractDynImage img >>= pixelize w h of case extractDynImage img >>= pixelize w h of
Nothing -> return () Nothing -> return ()
Just (f,b) -> Just (f,b) ->
let str = if c then img2ascii conv (f,b) else img2ascii conv256 (f,b) let str = if redcol then img2ascii conv256 (f,b) else img2ascii conv (f,b)
in mapM_ (\x -> putStr x >> putStrLn "\x1b[0m") (concat <$> str) in mapM_ (\x -> putStr x >> putStrLn "\x1b[0m") (concat <$> str)
chunksof :: Int -> [a] -> [[a]] chunksof :: Int -> [a] -> [[a]]