diff options
Diffstat (limited to 'src/WWW/Colors/Instances.hs')
| -rw-r--r-- | src/WWW/Colors/Instances.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/WWW/Colors/Instances.hs b/src/WWW/Colors/Instances.hs index 3fc7667..3dd6e6a 100644 --- a/src/WWW/Colors/Instances.hs +++ b/src/WWW/Colors/Instances.hs @@ -2,6 +2,7 @@ module WWW.Colors.Instances where import Clay.Color qualified as Clay +import Clay.Property qualified as Clay import Data.Colour import Data.Colour.SRGB (toSRGB24, sRGB24, RGB (..)) import Diagrams.Attributes @@ -13,7 +14,7 @@ instance Color Clay.Color where toAlphaColour col = case Clay.toRgba col of Clay.Rgba r g b a -> let rgb = sRGB24 (fromInteger r) (fromInteger g) (fromInteger b) - in alphaColourConvert $ withOpacity rgb a + in alphaColourConvert $ rgb `withOpacity` a _ -> error "Should not happen" fromAlphaColour :: AlphaColour Double -> Clay.Color @@ -21,3 +22,6 @@ instance Color Clay.Color where let a = alphaChannel $ alphaColourConvert col RGB r g b = toInteger <$> toSRGB24 (fromAlphaColour @(Colour Double) col) in Clay.rgba r g b a + +instance Clay.Val SomeColor where + value = Clay.value . fromAlphaColour @Clay.Color . someToAlpha |
