ColorWheel/app/Main.hs
2020-03-14 04:04:27 +03:00

27 lines
711 B
Haskell

module Main where
import ColorWheel.HSVTransformations
import System.Environment
import System.Exit
import ColorWheel.RGBPurifier
import Numeric (showHex, showIntAtBase)
import Data.List
import Text.Printf
intToHex :: [Int] -> [String]
intToHex y = fmap (\x -> showHex x "") y
main :: IO ()
main = do
args <- getArgs
let firstArg = (\x -> if length args > 0 then args !! 0 else []) args
case firstArg of
"--hsv2rgb" -> do
y <- hsv2rgb (read $ args !! 1) (read $ args !! 2) (read $ args !! 3) >>= \x -> return $ flooredRgb x
let c = 124 :: Int
putStrLn $ printf "%02x%02x%02x" (y !! 0) (y !! 1) (y !! 2)
-- print $ intercalate "" (intToHex y)
[] -> print "please provide parameter"