purescript-contrib / purescript-css

A clean, type-safe library for describing, manipulating and rendering CSS
Apache License 2.0
106 stars 40 forks source link

Problems with Color module #22

Closed sharkdp closed 8 years ago

sharkdp commented 8 years ago

Excerpt from the current CSS.Color module:

-data Color = Rgba Int Int Int Int      
-           | Hsla Number Number Number Number      
-           | Other Value       
-       
-instance isStringColor :: IsString Color where     
-  fromString = Other <<< fromString        
-       
-instance valColor :: Val Color where       
-  value (Rgba r g b 255) = Value <<< fromString $ "rgb(" <> intercalate ", " [show r, show g, show b] <> ")"       
-  value (Rgba r g b a) = Value <<< fromString $ "rgba(" <> intercalate ", " [show r, show g, show b, show a] <> ")"        
-  value (Hsla h s l 1.0) = Value <<< fromString $ "hsl(" <> intercalate ", " [show h, show s, show l] <> ")"       
-  value (Hsla h s l a) = Value <<< fromString $ "hsla(" <> intercalate ", " [show h, show s, show l, show a] <> ")"        
-  value (Other v) = v      

I think there are a few problems with this:

Consequently, RGBA, HSL and HSLA are not working right now (only RGB).