18 lines
334 B
Haskell
18 lines
334 B
Haskell
|
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
|