25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

27 satır
711B

  1. module Main where
  2. import ColorWheel.HSVTransformations
  3. import System.Environment
  4. import System.Exit
  5. import ColorWheel.RGBPurifier
  6. import Numeric (showHex, showIntAtBase)
  7. import Data.List
  8. import Text.Printf
  9. intToHex :: [Int] -> [String]
  10. intToHex y = fmap (\x -> showHex x "") y
  11. main :: IO ()
  12. main = do
  13. args <- getArgs
  14. let firstArg = (\x -> if length args > 0 then args !! 0 else []) args
  15. case firstArg of
  16. "--hsv2rgb" -> do
  17. y <- hsv2rgb (read $ args !! 1) (read $ args !! 2) (read $ args !! 3) >>= \x -> return $ flooredRgb x
  18. let c = 124 :: Int
  19. putStrLn $ printf "%02x%02x%02x" (y !! 0) (y !! 1) (y !! 2)
  20. -- print $ intercalate "" (intToHex y)
  21. [] -> print "please provide parameter"