diff --git a/src/Affection/Types.hs b/src/Affection/Types.hs index 0c350ef..93bc849 100644 --- a/src/Affection/Types.hs +++ b/src/Affection/Types.hs @@ -13,8 +13,8 @@ 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 + | x < 0 = x - (x `div` 256) * 255 + 1 + | otherwise = x - (x `div` 256) * 255 getR :: RGBA -> Int getR (RGBA r _ _ _) = r