From: sabadev Date: Sun, 21 Mar 2021 04:35:34 +0000 (-0400) Subject: Factored out default color selection in getIndividualColor to eliminate code duplication. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=1f63402bbbd0a6aa5e4624616d81d645e41dbf85;p=website.git Factored out default color selection in getIndividualColor to eliminate code duplication. --- diff --git a/src/Server.hs b/src/Server.hs index c3d0fbe..e2897ee 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -51,5 +51,8 @@ getColorFromInput lightDark redColor greenColor blueColor = do C.rgba red green blue 1 getIndividualColor :: LightDark -> Maybe Integer -> Integer -getIndividualColor Dark value = flip mod 0x100 $ fromMaybe 0x00 value -getIndividualColor Light value = flip mod 0x100 $ fromMaybe 0xFF value +getIndividualColor color = flip mod 0x100 . fromMaybe (defaultColor color) + +defaultColor :: LightDark -> Integer +defaultColor Dark = 0x00 +defaultColor Light = 0xFF