affection/src/Affection/Types.hs

18 lines
334 B
Haskell
Raw Normal View History

2016-03-25 15:58:46 +00:00
module Affection.Types
( newRGBA
) where
data RGBA = RGBA
{ r :: Int
, g :: Int
, b :: Int
, a :: Int
}
newRGBA :: Int -> Int -> Int -> Int -> RGBA
newRGBA r g b a = RGBA (overflow r) (overflow g) (overflow b) (overflow a)
where
overflow x
| x < 0 = 255 + (x `mod` 255)
| otherwise = x `mod` 255