Color 0.1.0 → 0.1.1
raw patch · 31 files changed
+710/−388 lines, 31 filesdep +Colordep −colorPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: Color
Dependencies removed: color
API changes (from Hackage documentation)
- Graphics.Color.Model: pattern ColorH360SI :: Double -> Double -> Double -> Color HSI Double
- Graphics.Color.Model: pattern ColorH360SL :: Double -> Double -> Double -> Color HSL Double
- Graphics.Color.Model: pattern ColorH360SV :: Double -> Double -> Double -> Color HSV Double
+ Graphics.Color.Illuminant.CIE1931: instance GHC.Enum.Bounded Graphics.Color.Illuminant.CIE1931.CIE1931
+ Graphics.Color.Illuminant.CIE1931: instance GHC.Read.Read Graphics.Color.Illuminant.CIE1931.CIE1931
+ Graphics.Color.Illuminant.CIE1964: instance GHC.Enum.Bounded Graphics.Color.Illuminant.CIE1964.CIE1964
+ Graphics.Color.Illuminant.CIE1964: instance GHC.Read.Read Graphics.Color.Illuminant.CIE1964.CIE1964
+ Graphics.Color.Illuminant.Wikipedia: A :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: B :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: C :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: D50 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: D55 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: D65 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: D75 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: E :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F1 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F10 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F11 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F12 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F2 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F3 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F4 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F5 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F6 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F7 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F8 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: F9 :: Degree2
+ Graphics.Color.Illuminant.Wikipedia: data Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance GHC.Classes.Eq Graphics.Color.Illuminant.Wikipedia.Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance GHC.Enum.Bounded Graphics.Color.Illuminant.Wikipedia.Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance GHC.Enum.Enum Graphics.Color.Illuminant.Wikipedia.Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance GHC.Read.Read Graphics.Color.Illuminant.Wikipedia.Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance GHC.Show.Show Graphics.Color.Illuminant.Wikipedia.Degree2
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.A
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.B
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.C
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.D50
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.D55
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.D65
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.D75
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.E
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F1
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F10
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F11
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F12
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F2
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F3
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F4
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F5
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F6
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F7
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F8
+ Graphics.Color.Illuminant.Wikipedia: instance Graphics.Color.Space.Internal.Illuminant 'Graphics.Color.Illuminant.Wikipedia.F9
+ Graphics.Color.Model: pattern ColorH360SV :: Fractional e => e -> e -> e -> Color HSV e
+ Graphics.Color.Space: convertColor :: forall cs cs' i e. (ColorSpace cs' i e, ColorSpace cs i e) => Color cs' e -> Color cs e
+ Graphics.Color.Space: convertColorFloat :: forall cs cs' i e. (ColorSpace cs' i e, ColorSpace cs i e) => Color cs' e -> Color cs e
- Graphics.Color.Space.RGB.Alternative.HSI: pattern ColorH360SI :: RealFloat e => e -> e -> e -> Color (HSI cs) e
+ Graphics.Color.Space.RGB.Alternative.HSI: pattern ColorH360SI :: Fractional e => e -> e -> e -> Color (HSI cs) e
- Graphics.Color.Space.RGB.Alternative.HSL: pattern ColorH360SL :: RealFloat e => e -> e -> e -> Color (HSL cs) e
+ Graphics.Color.Space.RGB.Alternative.HSL: pattern ColorH360SL :: Fractional e => e -> e -> e -> Color (HSL cs) e
- Graphics.Color.Space.RGB.Alternative.HSV: pattern ColorH360SV :: RealFloat e => e -> e -> e -> Color (HSV cs) e
+ Graphics.Color.Space.RGB.Alternative.HSV: pattern ColorH360SV :: Fractional e => e -> e -> e -> Color (HSV cs) e
Files
- CHANGELOG.md +6/−1
- Color.cabal +11/−10
- README.md +2/−57
- src/Graphics/Color/Adaptation.hs +0/−5
- src/Graphics/Color/Adaptation/VonKries.hs +4/−4
- src/Graphics/Color/Illuminant/CIE1931.hs +2/−2
- src/Graphics/Color/Illuminant/CIE1964.hs +2/−2
- src/Graphics/Color/Illuminant/ICC/PCS.hs +10/−1
- src/Graphics/Color/Illuminant/ITU/Rec470.hs +25/−4
- src/Graphics/Color/Illuminant/ITU/Rec601.hs +12/−2
- src/Graphics/Color/Illuminant/Wikipedia.hs +180/−0
- src/Graphics/Color/Model/HSI.hs +1/−1
- src/Graphics/Color/Model/HSL.hs +1/−1
- src/Graphics/Color/Model/HSV.hs +1/−1
- src/Graphics/Color/Space.hs +28/−1
- src/Graphics/Color/Space/RGB/Alternative/HSI.hs +1/−1
- src/Graphics/Color/Space/RGB/Alternative/HSL.hs +1/−1
- src/Graphics/Color/Space/RGB/Alternative/HSV.hs +1/−1
- src/Graphics/Color/Space/RGB/Internal.hs +2/−2
- src/Graphics/Color/Standard/RAL.hs +216/−215
- tests/Graphics/Color/Illuminant/WikipediaSpec.hs +56/−0
- tests/Graphics/Color/Model/Common.hs +17/−1
- tests/Graphics/Color/Model/HSLSpec.hs +10/−0
- tests/Graphics/Color/Model/HSVSpec.hs +10/−0
- tests/Graphics/Color/Space/CIE1931/IlluminantSpec.hs +0/−50
- tests/Graphics/Color/Space/CIE1976/LABSpec.hs +21/−6
- tests/Graphics/Color/Space/Common.hs +54/−9
- tests/Graphics/Color/Space/RGB/Derived/SRGBSpec.hs +24/−3
- tests/Graphics/Color/Space/RGB/ITU/Rec709Spec.hs +1/−3
- tests/Graphics/Color/Space/RGB/SRGBSpec.hs +1/−2
- tests/Graphics/Color/Standard/RALSpec.hs +10/−2
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Changelog for color -## 0.0.0+## 0.1.1++* Addition of `Graphics.Color.Illuminant.Wikipedia` module+* Addition of `convertColor` and `convertColorFloat` functions++## 0.1.0 Initial alpha release
Color.cabal view
@@ -1,8 +1,8 @@ name: Color-version: 0.1.0-synopsis: Common color spaces and conversions between them-description: Please see the README on GitHub at <https://github.com/lehins/color#readme>-homepage: https://github.com/lehins/color+version: 0.1.1+synopsis: Color spaces and conversions between them+description: Please see the README on GitHub at <https://github.com/lehins/Color#readme>+homepage: https://github.com/lehins/Color license: BSD3 license-file: LICENSE author: Alexey Kuleshevich@@ -40,6 +40,7 @@ , Graphics.Color.Illuminant.ICC.PCS , Graphics.Color.Illuminant.ITU.Rec470 , Graphics.Color.Illuminant.ITU.Rec601+ , Graphics.Color.Illuminant.Wikipedia , Graphics.Color.Model , Graphics.Color.Space -- , Graphics.Color.Space.CIE1931.RGB@@ -102,14 +103,14 @@ type: exitcode-stdio-1.0 hs-source-dirs: tests main-is: Main.hs- other-modules: Graphics.Color.Model.Common+ other-modules: Graphics.Color.Illuminant.WikipediaSpec+ , Graphics.Color.Model.Common , Graphics.Color.Model.CMYKSpec , Graphics.Color.Model.HSISpec , Graphics.Color.Model.HSLSpec , Graphics.Color.Model.HSVSpec , Graphics.Color.Model.RGBSpec , Graphics.Color.Space.Common- , Graphics.Color.Space.CIE1931.IlluminantSpec , Graphics.Color.Space.CIE1976.LABSpec , Graphics.Color.Space.RGB.SRGBSpec , Graphics.Color.Space.RGB.Derived.SRGBSpec@@ -120,7 +121,7 @@ build-depends: HUnit , QuickCheck , base >= 4.8 && < 5- , color+ , Color , colour , hspec , random@@ -142,7 +143,7 @@ build-depends: base , doctest >=0.15 , QuickCheck- , color+ , Color , template-haskell default-language: Haskell2010 ghc-options: -Wall@@ -162,7 +163,7 @@ -O2 build-depends: base , criterion- , color+ , Color , colour , deepseq , random@@ -170,4 +171,4 @@ source-repository head type: git- location: https://github.com/lehins/color+ location: https://github.com/lehins/Color
README.md view
@@ -1,58 +1,3 @@-# color--| Language | Travis | Coveralls |Gitter.im |-|:--------:|:------:|:---------:|:--------:|-|  | [](https://travis-ci.org/lehins/color) | [](https://coveralls.io/github/lehins/color?branch=master) | [](https://gitter.im/haskell-massiv/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)--| Package | Hackage | Nightly | LTS |-|:-------------------|:-------:|:-------:|:---:|-| [`color`](https://github.com/lehins/color/tree/master/color)| [](https://hackage.haskell.org/package/color)| [](https://www.stackage.org/nightly/package/color)| [](https://www.stackage.org/lts/package/color)|--A library for dealing with colors and pixels. Currently supported:--* Color models:-- * `Y`- * `RGB`- * `HSI`- * `HSL`- * `HSV`- * `YCbCr`- * `CMYK`--* Color spaces and arbitrary conversions between them:-- * `Y` - luminance- * `XYZ`- * `La*b*`- * `RGB`:-- * `sRGB`- * `AdobeRGB`- * ITU: `Rec470`, `Rec601` and `Rec709`- * Alternative representations:-- * `HSI`- * `HSL`- * `HSV`- * `YCbCr`- * `CMYK`--* Illuminants:-- * CIE1931 - 2 degree observer- * CIE1964 - 10 degree observer- * Some common alternatives--* Chromatic adptation:-- * VonKries adptation with transformations:-- * VonKries- * Bradford (default)- * Fairchild- * CIECAM02--* Color Standards:+# Color - * RAL+See the repository for proper introduction: https://github.com/lehins/Color
src/Graphics/Color/Adaptation.hs view
@@ -1,8 +1,3 @@-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE TypeFamilies #-} -- | -- Module : Graphics.Color.Adaptation -- Copyright : (c) Alexey Kuleshevich 2019-2020
src/Graphics/Color/Adaptation/VonKries.hs view
@@ -18,8 +18,10 @@ -- Portability : non-portable -- module Graphics.Color.Adaptation.VonKries- ( VonKries(..)- , convert+ ( -- * Color conversion+ convert+ -- * Von Kries adaptation+ , VonKries(..) , CAT(..) , ICAT(..) , ChromaticAdaptationTransform@@ -37,8 +39,6 @@ import Graphics.Color.Adaptation.Internal import Graphics.Color.Algebra import Graphics.Color.Space.Internal---import Graphics.Color.Illuminant.CIE1931---import Graphics.Color.Space.RGB.SRGB import Data.Typeable data VonKries
src/Graphics/Color/Illuminant/CIE1931.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE DataKinds #-} -- | -- Module : Graphics.Color.Illuminant.CIE1931--- Copyright : (c) Alexey Kuleshevich 2019+-- Copyright : (c) Alexey Kuleshevich 2019-2020 -- License : BSD3 -- Maintainer : Alexey Kuleshevich <lehins@yandex.ru> -- Stability : experimental@@ -383,7 +383,7 @@ -- ^ High pressure metal halide lamp | HP5 -- ^ High pressure metal halide lamp- deriving (Eq, Show, Enum)+ deriving (Eq, Show, Read, Enum, Bounded) -- -- | Academy Color Encoding System -- data ACES =
src/Graphics/Color/Illuminant/CIE1964.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE TypeFamilies #-} -- | -- Module : Graphics.Color.Illuminant.CIE1964--- Copyright : (c) Alexey Kuleshevich 2019+-- Copyright : (c) Alexey Kuleshevich 2019-2020 -- License : BSD3 -- Maintainer : Alexey Kuleshevich <lehins@yandex.ru> -- Stability : experimental@@ -208,4 +208,4 @@ -- /Note/ - Takes precedence over other F illuminants | FL12 -- ^ Philips TL83, Ultralume 30- deriving (Eq, Show, Enum)+ deriving (Eq, Show, Read, Enum, Bounded)
src/Graphics/Color/Illuminant/ICC/PCS.hs view
@@ -16,8 +16,17 @@ import Graphics.Color.Space.Internal --- | This is an approximation of CIE1931 `Graphics.ColorSpace.Illuminant.CIE1931.'D50`+-- | This is an approximation of CIE1931 `Graphics.ColorSpace.Illuminant.CIE1931.D50` -- white point defined in ICC PCS. Useful for chromatic adaptation.+--+-- >>> whitePoint :: WhitePoint D50 Double+-- WhitePoint (Chromaticity <CIExyY * D50:( 0.345702914919, 0.358538596680)>)+-- >>> whitePointTristimulus :: Color (XYZ D50) Float+-- <XYZ * D50:( 0.964200, 1.000000, 0.824900)>+-- >>> colorTemperature :: CCT D50+-- CCT {unCCT = 5003.0}+--+-- @since 0.1.0 data D50 -- | Tristimulus @[X=0.9642, Y=1.0000, Z=0.8249]@ - /IEC 61966-2-1:1999/, /ICC PCS/
src/Graphics/Color/Illuminant/ITU/Rec470.hs view
@@ -19,8 +19,18 @@ --- | Whitepoint C that is used for ITU: Rec.470 (525). It is slightly different than the--- one defined by CIE1931, thus a separate daclaration in here.+-- | Whitepoint C that is used for ITU: Rec.470 (525). It is slightly different than+-- `Graphics.Color.Illuminant.CIE1931.C` that is defined by CIE1931, thus a separate+-- declaration in here.+--+-- >>> whitePoint :: WhitePoint C Float+-- WhitePoint (Chromaticity <CIExyY * C:( 0.310000, 0.316000)>)+-- >>> whitePointTristimulus :: Color (XYZ C) Float+-- <XYZ * C:( 0.981013, 1.000000, 1.183544)>+-- >>> colorTemperature :: CCT C+-- CCT {unCCT = 6774.0}+--+-- @since 0.1.0 data C @@ -31,8 +41,19 @@ --- ^ Whitepoint D65 that is used for ITU: Rec.470 (625). It is slightly different than the--- one defined by CIE1931 and the one in Rec.601, thus a separate declaration in here.+-- | Whitepoint D65 that is used for ITU: Rec.470 (625). It is slightly different than+-- `Graphics.Color.Illuminant.CIE1931.D65` that is defined by CIE1931 and+-- `Graphics.Color.Illuminant.ITU.Rec601.D65` specified in Rec.601, thus a separate+-- declaration in here.+--+-- >>> whitePoint :: WhitePoint D65 Float+-- WhitePoint (Chromaticity <CIExyY * D65:( 0.313000, 0.329000)>)+-- >>> whitePointTristimulus :: Color (XYZ D65) Float+-- <XYZ * D65:( 0.951368, 1.000000, 1.088146)>+-- >>> colorTemperature :: CCT D65+-- CCT {unCCT = 6504.0}+--+-- @since 0.1.0 data D65
src/Graphics/Color/Illuminant/ITU/Rec601.hs view
@@ -17,8 +17,18 @@ import Graphics.Color.Space.Internal -- | Whitepoint D65 that is so commonly used for sRGB and other color spaces defined by--- ITU: Rec.601 (525 and 625) and Rec.709 standards. It is slightly different than the--- one defined by CIE1931, thus a separate daclaration in here.+-- ITU: Rec.601 (525 and 625) and Rec.709 standards. It is slightly different than+-- `Graphics.Color.Illuminant.CIE1931.D65` that is defined by CIE1931 and+-- `Graphics.Color.Illuminant.ITU.Rec470.D65` specified in Rec.470.+--+-- >>> whitePoint :: WhitePoint D65 Float+-- WhitePoint (Chromaticity <CIExyY * D65:( 0.312700, 0.329000)>)+-- >>> whitePointTristimulus :: Color (XYZ D65) Float+-- <XYZ * D65:( 0.950456, 1.000000, 1.089058)>+-- >>> colorTemperature :: CCT D65+-- CCT {unCCT = 6504.0}+--+-- @since 0.1.0 data D65 -- | @[x=0.3127, y=0.3290]@ - /Rec. ITU-R BT.601-7/, /Rec. ITU-R BT.709-6/, /IEC 61966-2-1:1999/
+ src/Graphics/Color/Illuminant/Wikipedia.hs view
@@ -0,0 +1,180 @@+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE NegativeLiterals #-}+{-# LANGUAGE DataKinds #-}+-- |+-- Module : Graphics.Color.Illuminant.Wikipedia+-- Copyright : (c) Alexey Kuleshevich 2019-2020+-- License : BSD3+-- Maintainer : Alexey Kuleshevich <lehins@yandex.ru>+-- Stability : experimental+-- Portability : non-portable+--+module Graphics.Color.Illuminant.Wikipedia+ ( Degree2(..)+ ) where++import Graphics.Color.Space.Internal++-- | @[x=0.44757, y=0.40745]@ - 2° Observer - Wikipedia+instance Illuminant 'A where+ type Temperature 'A = 2856+ whitePoint = WhitePoint 0.44757 0.40745++-- | @[x=0.34842, y=0.35161]@ - 2° Observer - Wikipedia+instance Illuminant 'B where+ type Temperature 'B = 4874+ whitePoint = WhitePoint 0.34842 0.35161++-- | @[x=0.31006, y=0.31616]@ - 2° Observer - Wikipedia+instance Illuminant 'C where+ type Temperature 'C = 6774+ whitePoint = WhitePoint 0.31006 0.31616++-- | @[x=0.34567, y=0.35850]@ - 2° Observer - Wikipedia+instance Illuminant 'D50 where+ type Temperature 'D50 = 5003+ whitePoint = WhitePoint 0.34567 0.35850++-- | @[x=0.33242, y=0.34743]@ - 2° Observer - Wikipedia+instance Illuminant 'D55 where+ type Temperature 'D55 = 5503+ whitePoint = WhitePoint 0.33242 0.34743++-- | @[x=0.31271, y=0.32901]@ - 2° Observer - Wikipedia+instance Illuminant 'D65 where+ type Temperature 'D65 = 6504+ whitePoint = WhitePoint 0.31271 0.32902++-- | @[x=0.29902, y=0.31485]@ - 2° Observer - Wikipedia+instance Illuminant 'D75 where+ type Temperature 'D75 = 7504+ whitePoint = WhitePoint 0.29902 0.31485++-- | @[x=1/3, y=1/3]@ - 2° Observer - Wikipedia+instance Illuminant 'E where+ type Temperature 'E = 5454+ whitePoint = WhitePoint (1 / 3) (1 / 3)+++-- | @[x=0.31310, y=0.33727]@ - 2° Observer - Wikipedia+instance Illuminant 'F1 where+ type Temperature 'F1 = 6430+ whitePoint = WhitePoint 0.31310 0.33727++-- | @[x=0.37208, y=0.375129@ - 2° Observer - Wikipedia+instance Illuminant 'F2 where+ type Temperature 'F2 = 4230+ whitePoint = WhitePoint 0.37208 0.37529++-- | @[x=0.40910, y=0.39430]@ - 2° Observer - Wikipedia+instance Illuminant 'F3 where+ type Temperature 'F3 = 3450+ whitePoint = WhitePoint 0.40910 0.39430++-- | @[x=0.44018, y=0.40329]@ - 2° Observer - Wikipedia+instance Illuminant 'F4 where+ type Temperature 'F4 = 2940+ whitePoint = WhitePoint 0.44018 0.40329++-- | @[x=0.31379, y=0.34531]@ - 2° Observer - Wikipedia+instance Illuminant 'F5 where+ type Temperature 'F5 = 6350+ whitePoint = WhitePoint 0.31379 0.34531++-- | @[x=0.37790, y=0.38835]@ - 2° Observer - Wikipedia+instance Illuminant 'F6 where+ type Temperature 'F6 = 4150+ whitePoint = WhitePoint 0.37790 0.38835++-- | @[x=0.31292, y=0.32933]@ - 2° Observer - Wikipedia+instance Illuminant 'F7 where+ type Temperature 'F7 = 6500+ whitePoint = WhitePoint 0.31292 0.32933++-- | @[x=0.34588, y=0.35875]@ - 2° Observer - Wikipedia+instance Illuminant 'F8 where+ type Temperature 'F8 = 5000+ whitePoint = WhitePoint 0.34588 0.35875++-- | @[x=0.37417, y=0.37281]@ - 2° Observer - Wikipedia+instance Illuminant 'F9 where+ type Temperature 'F9 = 4150+ whitePoint = WhitePoint 0.37417 0.37281++-- | @[x=0.34609, y=0.35986]@ - 2° Observer - Wikipedia+instance Illuminant 'F10 where+ type Temperature 'F10 = 5000+ whitePoint = WhitePoint 0.34609 0.35986++-- | @[x=0.38052, y=0.37713]@ - 2° Observer - Wikipedia+instance Illuminant 'F11 where+ type Temperature 'F11 = 4000+ whitePoint = WhitePoint 0.38052 0.37713++-- | @[x=0.43695, y=0.40441]@ - 2° Observer - Wikipedia+instance Illuminant 'F12 where+ type Temperature 'F12 = 3000+ whitePoint = WhitePoint 0.43695 0.40441+++-- | 2° observer [Standard+-- Illuminants](https://en.wikipedia.org/wiki/Standard_illuminant#White_point) listed on+-- Wikipedia. Despite the fact that they have slightly different chromaticity coordinates+-- than the actual CIE1931 standard papers, these are very commmonly used values. For+-- better interoperability it is better to use the actual+-- `Graphics.Color.Illuminant.CIE1931.CIE1931` illuminants.+--+-- @since 0.1.1+data Degree2+ = A+ -- ^ Incandescent / Tungsten+ | B+ -- ^ Direct sunlight at noon (obsolete)+ | C+ -- ^ Average / North sky Daylight (obsolete)+ | D50+ -- ^ Horizon Light.+ | D55+ -- ^ Mid-morning / Mid-afternoon Daylight+ | D65+ -- ^ Noon Daylight+ | D75+ -- ^ Overcast dayligh / North sky Daylight+ | E+ -- ^ Equal energy+ | F1+ -- ^ Daylight Fluorescent+ | F2+ -- ^ The fluorescent illuminant in most common use, represents cool white fluorescent+ -- (4100° Kelvin, CRI 60). Non-standard names include F, F02, Fcw, CWF, CWF2.+ --+ -- /Note/ - Takes precedence over other F illuminants+ | F3+ -- ^ White Fluorescent+ | F4+ -- ^ Warm White Fluorescent+ | F5+ -- ^ Daylight Fluorescent+ | F6+ -- ^ Lite White Fluorescent+ | F7+ -- ^ Represents a broadband fluorescent lamp, which approximates CIE illuminant `D65`+ -- (6500° Kelvin, CRI 90).+ --+ -- /Note/ - Takes precedence over other F illuminants+ | F8+ -- ^ `D50` simulator, Sylvania F40 Design 50 (F40DSGN50)+ | F9+ -- ^ Cool White Deluxe Fluorescent+ | F10+ -- ^ Philips TL85, Ultralume 50+ | F11+ -- ^ Philips TL84, SP41, Ultralume 40+ --+ -- Represents a narrow tri-band fluorescent of 4000° Kelvin color temperature, CRI 83.+ --+ -- /Note/ - Takes precedence over other F illuminants+ | F12+ -- ^ Philips TL83, Ultralume 30+ deriving (Eq, Show, Read, Enum, Bounded)
src/Graphics/Color/Model/HSI.hs view
@@ -58,7 +58,7 @@ -- | Constructor for an HSI color model. Difference from `ColorHSI` is that channels are -- restricted to `Double` and the hue is specified in 0 to 360 degree range, rather than 0 -- to 1. Note, that this is not checked.-pattern ColorH360SI :: Double -> Double -> Double -> Color HSI Double+pattern ColorH360SI :: Fractional e => e -> e -> e -> Color HSI e pattern ColorH360SI h s i <- ColorHSI ((* 360) -> h) s i where ColorH360SI h s i = ColorHSI (h / 360) s i {-# COMPLETE ColorH360SI #-}
src/Graphics/Color/Model/HSL.hs view
@@ -60,7 +60,7 @@ -- | Constructor for an HSL color model. Difference from `ColorHSL` is that channels are -- restricted to `Double` and the hue is specified in 0 to 360 degree range, rather than 0 -- to 1. Note, that this is not checked.-pattern ColorH360SL :: Double -> Double -> Double -> Color HSL Double+pattern ColorH360SL :: Fractional e => e -> e -> e -> Color HSL e pattern ColorH360SL h s l <- ColorHSL ((* 360) -> h) s l where ColorH360SL h s l = ColorHSL (h / 360) s l {-# COMPLETE ColorH360SL #-}
src/Graphics/Color/Model/HSV.hs view
@@ -59,7 +59,7 @@ -- | Constructor for an HSV color model. Difference from `ColorHSV` is that channels are -- restricted to `Double` and the hue is specified in 0 to 360 degree range, rather than 0 -- to 1. Note, that this is not checked.-pattern ColorH360SV :: Double -> Double -> Double -> Color HSV Double+pattern ColorH360SV :: Fractional e => e -> e -> e -> Color HSV e pattern ColorH360SV h s v <- ColorHSV ((* 360) -> h) s v where ColorH360SV h s v = ColorHSV (h / 360) s v {-# COMPLETE ColorH360SV #-}
src/Graphics/Color/Space.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE ScopedTypeVariables #-} -- | -- Module : Graphics.Color.Space -- Copyright : (c) Alexey Kuleshevich 2018-2019@@ -7,10 +9,35 @@ -- Portability : non-portable -- module Graphics.Color.Space- ( module X+ ( convertColor+ , convertColorFloat+ , module X ) where import Graphics.Color.Model.Alpha as X import Graphics.Color.Model.Internal as X import Graphics.Color.Space.Internal as X import Graphics.Color.Space.RGB.Internal as X+++-- | Convert a color space through `XYZ` intermediary with `Double` precision. Illuminant is+-- enforced to be the same, but in case that it is a limitation and chromatic adaptation is+-- needed `Graphics.Color.Adaptation.convertWith` can be used instead.+--+-- @since 0.1.1+convertColor ::+ forall cs cs' i e. (ColorSpace cs' i e, ColorSpace cs i e)+ => Color cs' e+ -> Color cs e+convertColor = fromColorXYZ . (toColorXYZ :: Color cs' e -> Color (XYZ i) Double)+{-# INLINE convertColor #-}++-- | Same as `convertColor`, but use 32but `Float` asn an intermediary precision+--+-- @since 0.1.1+convertColorFloat ::+ forall cs cs' i e. (ColorSpace cs' i e, ColorSpace cs i e)+ => Color cs' e+ -> Color cs e+convertColorFloat = fromColorXYZ . (toColorXYZ :: Color cs' e -> Color (XYZ i) Float)+{-# INLINE convertColorFloat #-}
src/Graphics/Color/Space/RGB/Alternative/HSI.hs view
@@ -77,7 +77,7 @@ -- | Constructor for an RGB color space in an alternative HSI color model. Difference from -- `ColorHSI` is that the hue is specified in 0 to 360 degree range, rather than 0 to -- 1. Note, that this is not checked.-pattern ColorH360SI :: RealFloat e => e -> e -> e -> Color (HSI cs) e+pattern ColorH360SI :: Fractional e => e -> e -> e -> Color (HSI cs) e pattern ColorH360SI h s i <- ColorHSI ((* 360) -> h) s i where ColorH360SI h s i = ColorHSI (h / 360) s i {-# COMPLETE ColorH360SI #-}
src/Graphics/Color/Space/RGB/Alternative/HSL.hs view
@@ -76,7 +76,7 @@ -- | Constructor for an RGB color space in an alternative HSL color model. Difference from -- `ColorHSL` is that the hue is specified in 0 to 360 degree range, rather than 0 to -- 1. Note, that this is not checked.-pattern ColorH360SL :: RealFloat e => e -> e -> e -> Color (HSL cs) e+pattern ColorH360SL :: Fractional e => e -> e -> e -> Color (HSL cs) e pattern ColorH360SL h s i <- ColorHSL ((* 360) -> h) s i where ColorH360SL h s i = ColorHSL (h / 360) s i {-# COMPLETE ColorH360SL #-}
src/Graphics/Color/Space/RGB/Alternative/HSV.hs view
@@ -75,7 +75,7 @@ -- | Constructor for an RGB color space in an alternative HSV color model. Difference from -- `ColorHSV` is that the hue is specified in 0 to 360 degree range, rather than 0 to -- 1. Note, that this is not checked.-pattern ColorH360SV :: RealFloat e => e -> e -> e -> Color (HSV cs) e+pattern ColorH360SV :: Fractional e => e -> e -> e -> Color (HSV cs) e pattern ColorH360SV h s i <- ColorHSV ((* 360) -> h) s i where ColorH360SV h s i = ColorHSV (h / 360) s i {-# COMPLETE ColorH360SV #-}
src/Graphics/Color/Space/RGB/Internal.hs view
@@ -22,9 +22,9 @@ -- Portability : non-portable -- module Graphics.Color.Space.RGB.Internal- ( RedGreenBlue(..)- , pattern ColorRGB+ ( pattern ColorRGB , pattern ColorRGBA+ , RedGreenBlue(..) , Gamut(..) , rgb2xyz , xyz2rgb
src/Graphics/Color/Standard/RAL.hs view
@@ -922,218 +922,219 @@ instance StandardColor RAL 9023 where color _ = pearlDarkGrey -instance StandardColor RAL "Green beige" where color _ = color (RAL :: RAL 1000)-instance StandardColor RAL "Beige" where color _ = color (RAL :: RAL 1001)-instance StandardColor RAL "Sand yellow" where color _ = color (RAL :: RAL 1002)-instance StandardColor RAL "Signal yellow" where color _ = color (RAL :: RAL 1003)-instance StandardColor RAL "Golden yellow" where color _ = color (RAL :: RAL 1004)-instance StandardColor RAL "Honey yellow" where color _ = color (RAL :: RAL 1005)-instance StandardColor RAL "Maize yellow" where color _ = color (RAL :: RAL 1006)-instance StandardColor RAL "Daffodil yellow" where color _ = color (RAL :: RAL 1007)-instance StandardColor RAL "Brown beige" where color _ = color (RAL :: RAL 1011)-instance StandardColor RAL "Lemon yellow" where color _ = color (RAL :: RAL 1012)-instance StandardColor RAL "Oyster white" where color _ = color (RAL :: RAL 1013)-instance StandardColor RAL "Ivory" where color _ = color (RAL :: RAL 1014)-instance StandardColor RAL "Light ivory" where color _ = color (RAL :: RAL 1015)-instance StandardColor RAL "Sulfur yellow" where color _ = color (RAL :: RAL 1016)-instance StandardColor RAL "Saffron yellow" where color _ = color (RAL :: RAL 1017)-instance StandardColor RAL "Zinc yellow" where color _ = color (RAL :: RAL 1018)-instance StandardColor RAL "Grey beige" where color _ = color (RAL :: RAL 1019)-instance StandardColor RAL "Olive yellow" where color _ = color (RAL :: RAL 1020)-instance StandardColor RAL "Rape yellow" where color _ = color (RAL :: RAL 1021)-instance StandardColor RAL "Traffic yellow" where color _ = color (RAL :: RAL 1023)-instance StandardColor RAL "Ochre yellow" where color _ = color (RAL :: RAL 1024)-instance StandardColor RAL "Luminous yellow" where color _ = color (RAL :: RAL 1026)-instance StandardColor RAL "Curry yellow" where color _ = color (RAL :: RAL 1027)-instance StandardColor RAL "Melon yellow" where color _ = color (RAL :: RAL 1028)-instance StandardColor RAL "Broom yellow" where color _ = color (RAL :: RAL 1032)-instance StandardColor RAL "Dahlia yellow" where color _ = color (RAL :: RAL 1033)-instance StandardColor RAL "Pastel yellow" where color _ = color (RAL :: RAL 1034)-instance StandardColor RAL "Pearl beige" where color _ = color (RAL :: RAL 1035)-instance StandardColor RAL "Pearl gold" where color _ = color (RAL :: RAL 1036)-instance StandardColor RAL "Sun yellow" where color _ = color (RAL :: RAL 1037)-instance StandardColor RAL "Yellow orange" where color _ = color (RAL :: RAL 2000)-instance StandardColor RAL "Red orange" where color _ = color (RAL :: RAL 2001)-instance StandardColor RAL "Vermilion" where color _ = color (RAL :: RAL 2002)-instance StandardColor RAL "Pastel orange" where color _ = color (RAL :: RAL 2003)-instance StandardColor RAL "Pure orange" where color _ = color (RAL :: RAL 2004)-instance StandardColor RAL "Luminous orange" where color _ = color (RAL :: RAL 2005)-instance StandardColor RAL "Luminous bright orange" where color _ = color (RAL :: RAL 2007)-instance StandardColor RAL "Bright red orange" where color _ = color (RAL :: RAL 2008)-instance StandardColor RAL "Traffic orange" where color _ = color (RAL :: RAL 2009)-instance StandardColor RAL "Signal orange" where color _ = color (RAL :: RAL 2010)-instance StandardColor RAL "Deep orange" where color _ = color (RAL :: RAL 2011)-instance StandardColor RAL "Salmon orange" where color _ = color (RAL :: RAL 2012)-instance StandardColor RAL "Pearl orange" where color _ = color (RAL :: RAL 2013)-instance StandardColor RAL "Flame red" where color _ = color (RAL :: RAL 3000)-instance StandardColor RAL "Signal red" where color _ = color (RAL :: RAL 3001)-instance StandardColor RAL "Carmine red" where color _ = color (RAL :: RAL 3002)-instance StandardColor RAL "Ruby red" where color _ = color (RAL :: RAL 3003)-instance StandardColor RAL "Purple red" where color _ = color (RAL :: RAL 3004)-instance StandardColor RAL "Wine red" where color _ = color (RAL :: RAL 3005)-instance StandardColor RAL "Black red" where color _ = color (RAL :: RAL 3007)-instance StandardColor RAL "Oxide red" where color _ = color (RAL :: RAL 3009)-instance StandardColor RAL "Brown red" where color _ = color (RAL :: RAL 3011)-instance StandardColor RAL "Beige red" where color _ = color (RAL :: RAL 3012)-instance StandardColor RAL "Tomato red" where color _ = color (RAL :: RAL 3013)-instance StandardColor RAL "Antique pink" where color _ = color (RAL :: RAL 3014)-instance StandardColor RAL "Light pink" where color _ = color (RAL :: RAL 3015)-instance StandardColor RAL "Coral red" where color _ = color (RAL :: RAL 3016)-instance StandardColor RAL "Rose" where color _ = color (RAL :: RAL 3017)-instance StandardColor RAL "Strawberry red" where color _ = color (RAL :: RAL 3018)-instance StandardColor RAL "Traffic red" where color _ = color (RAL :: RAL 3020)-instance StandardColor RAL "Salmon pink" where color _ = color (RAL :: RAL 3022)-instance StandardColor RAL "Luminous red" where color _ = color (RAL :: RAL 3024)-instance StandardColor RAL "Luminous bright red" where color _ = color (RAL :: RAL 3026)-instance StandardColor RAL "Raspberry red" where color _ = color (RAL :: RAL 3027)-instance StandardColor RAL "Pure red" where color _ = color (RAL :: RAL 3028)-instance StandardColor RAL "Orient red" where color _ = color (RAL :: RAL 3031)-instance StandardColor RAL "Pearl ruby red" where color _ = color (RAL :: RAL 3032)-instance StandardColor RAL "Pearl pink" where color _ = color (RAL :: RAL 3033)-instance StandardColor RAL "Red lilac" where color _ = color (RAL :: RAL 4001)-instance StandardColor RAL "Red violet" where color _ = color (RAL :: RAL 4002)-instance StandardColor RAL "Heather violet" where color _ = color (RAL :: RAL 4003)-instance StandardColor RAL "Claret violet" where color _ = color (RAL :: RAL 4004)-instance StandardColor RAL "Blue lilac" where color _ = color (RAL :: RAL 4005)-instance StandardColor RAL "Traffic purple" where color _ = color (RAL :: RAL 4006)-instance StandardColor RAL "Purple violet" where color _ = color (RAL :: RAL 4007)-instance StandardColor RAL "Signal violet" where color _ = color (RAL :: RAL 4008)-instance StandardColor RAL "Pastel violet" where color _ = color (RAL :: RAL 4009)-instance StandardColor RAL "Telemagenta" where color _ = color (RAL :: RAL 4010)-instance StandardColor RAL "Pearl violet" where color _ = color (RAL :: RAL 4011)-instance StandardColor RAL "Pearl blackberry" where color _ = color (RAL :: RAL 4012)-instance StandardColor RAL "Violet blue" where color _ = color (RAL :: RAL 5000)-instance StandardColor RAL "Green blue" where color _ = color (RAL :: RAL 5001)-instance StandardColor RAL "Ultramarine blue" where color _ = color (RAL :: RAL 5002)-instance StandardColor RAL "Sapphire blue" where color _ = color (RAL :: RAL 5003)-instance StandardColor RAL "Black blue" where color _ = color (RAL :: RAL 5004)-instance StandardColor RAL "Signal blue" where color _ = color (RAL :: RAL 5005)-instance StandardColor RAL "Brilliant blue" where color _ = color (RAL :: RAL 5007)-instance StandardColor RAL "Grey blue" where color _ = color (RAL :: RAL 5008)-instance StandardColor RAL "Azure blue" where color _ = color (RAL :: RAL 5009)-instance StandardColor RAL "Gentian blue" where color _ = color (RAL :: RAL 5010)-instance StandardColor RAL "Steel blue" where color _ = color (RAL :: RAL 5011)-instance StandardColor RAL "Light blue" where color _ = color (RAL :: RAL 5012)-instance StandardColor RAL "Cobalt blue" where color _ = color (RAL :: RAL 5013)-instance StandardColor RAL "Pigeon blue" where color _ = color (RAL :: RAL 5014)-instance StandardColor RAL "Sky blue" where color _ = color (RAL :: RAL 5015)-instance StandardColor RAL "Traffic blue" where color _ = color (RAL :: RAL 5017)-instance StandardColor RAL "Turquoise blue" where color _ = color (RAL :: RAL 5018)-instance StandardColor RAL "Capri blue" where color _ = color (RAL :: RAL 5019)-instance StandardColor RAL "Ocean blue" where color _ = color (RAL :: RAL 5020)-instance StandardColor RAL "Water blue" where color _ = color (RAL :: RAL 5021)-instance StandardColor RAL "Night blue" where color _ = color (RAL :: RAL 5022)-instance StandardColor RAL "Distant blue" where color _ = color (RAL :: RAL 5023)-instance StandardColor RAL "Pastel blue" where color _ = color (RAL :: RAL 5024)-instance StandardColor RAL "Pearl gentian blue" where color _ = color (RAL :: RAL 5025)-instance StandardColor RAL "Pearl night blue" where color _ = color (RAL :: RAL 5026)-instance StandardColor RAL "Patina green" where color _ = color (RAL :: RAL 6000)-instance StandardColor RAL "Emerald green" where color _ = color (RAL :: RAL 6001)-instance StandardColor RAL "Leaf green" where color _ = color (RAL :: RAL 6002)-instance StandardColor RAL "Olive green" where color _ = color (RAL :: RAL 6003)-instance StandardColor RAL "Blue green" where color _ = color (RAL :: RAL 6004)-instance StandardColor RAL "Moss green" where color _ = color (RAL :: RAL 6005)-instance StandardColor RAL "Grey olive" where color _ = color (RAL :: RAL 6006)-instance StandardColor RAL "Bottle green" where color _ = color (RAL :: RAL 6007)-instance StandardColor RAL "Brown green" where color _ = color (RAL :: RAL 6008)-instance StandardColor RAL "Fir green" where color _ = color (RAL :: RAL 6009)-instance StandardColor RAL "Grass green" where color _ = color (RAL :: RAL 6010)-instance StandardColor RAL "Reseda green" where color _ = color (RAL :: RAL 6011)-instance StandardColor RAL "Black green" where color _ = color (RAL :: RAL 6012)-instance StandardColor RAL "Reed green" where color _ = color (RAL :: RAL 6013)-instance StandardColor RAL "Yellow olive" where color _ = color (RAL :: RAL 6014)-instance StandardColor RAL "Black olive" where color _ = color (RAL :: RAL 6015)-instance StandardColor RAL "Turquoise green" where color _ = color (RAL :: RAL 6016)-instance StandardColor RAL "May green" where color _ = color (RAL :: RAL 6017)-instance StandardColor RAL "Yellow green" where color _ = color (RAL :: RAL 6018)-instance StandardColor RAL "Pastel green" where color _ = color (RAL :: RAL 6019)-instance StandardColor RAL "Chrome green" where color _ = color (RAL :: RAL 6020)-instance StandardColor RAL "Pale green" where color _ = color (RAL :: RAL 6021)-instance StandardColor RAL "Olive-drab" where color _ = color (RAL :: RAL 6022)-instance StandardColor RAL "Brown olive" where color _ = color (RAL :: RAL 6022)-instance StandardColor RAL "Traffic green" where color _ = color (RAL :: RAL 6024)-instance StandardColor RAL "Fern green" where color _ = color (RAL :: RAL 6025)-instance StandardColor RAL "Opal green" where color _ = color (RAL :: RAL 6026)-instance StandardColor RAL "Light green" where color _ = color (RAL :: RAL 6027)-instance StandardColor RAL "Pine green" where color _ = color (RAL :: RAL 6028)-instance StandardColor RAL "Mint green" where color _ = color (RAL :: RAL 6029)-instance StandardColor RAL "Signal green" where color _ = color (RAL :: RAL 6032)-instance StandardColor RAL "Mint turquoise" where color _ = color (RAL :: RAL 6033)-instance StandardColor RAL "Pastel turquoise" where color _ = color (RAL :: RAL 6034)-instance StandardColor RAL "Pearl green" where color _ = color (RAL :: RAL 6035)-instance StandardColor RAL "Pearl opal green" where color _ = color (RAL :: RAL 6036)-instance StandardColor RAL "Pure green" where color _ = color (RAL :: RAL 6037)-instance StandardColor RAL "Luminous green" where color _ = color (RAL :: RAL 6038)-instance StandardColor RAL "Squirrel grey" where color _ = color (RAL :: RAL 7000)-instance StandardColor RAL "Silver grey" where color _ = color (RAL :: RAL 7001)-instance StandardColor RAL "Olive grey" where color _ = color (RAL :: RAL 7002)-instance StandardColor RAL "Moss grey" where color _ = color (RAL :: RAL 7003)-instance StandardColor RAL "Signal grey" where color _ = color (RAL :: RAL 7004)-instance StandardColor RAL "Mouse grey" where color _ = color (RAL :: RAL 7005)-instance StandardColor RAL "Beige grey" where color _ = color (RAL :: RAL 7006)-instance StandardColor RAL "Khaki grey" where color _ = color (RAL :: RAL 7008)-instance StandardColor RAL "Green grey" where color _ = color (RAL :: RAL 7009)-instance StandardColor RAL "Tarpaulin grey" where color _ = color (RAL :: RAL 7010)-instance StandardColor RAL "Iron grey" where color _ = color (RAL :: RAL 7011)-instance StandardColor RAL "Basalt grey" where color _ = color (RAL :: RAL 7012)-instance StandardColor RAL "Brown grey" where color _ = color (RAL :: RAL 7013)-instance StandardColor RAL "NATO olive" where color _ = color (RAL :: RAL 7013)-instance StandardColor RAL "Slate grey" where color _ = color (RAL :: RAL 7015)-instance StandardColor RAL "Anthracite grey" where color _ = color (RAL :: RAL 7016)-instance StandardColor RAL "Black grey" where color _ = color (RAL :: RAL 7021)-instance StandardColor RAL "Umbra grey" where color _ = color (RAL :: RAL 7022)-instance StandardColor RAL "Concrete grey" where color _ = color (RAL :: RAL 7023)-instance StandardColor RAL "Graphite grey" where color _ = color (RAL :: RAL 7024)-instance StandardColor RAL "Granite grey" where color _ = color (RAL :: RAL 7026)-instance StandardColor RAL "Stone grey" where color _ = color (RAL :: RAL 7030)-instance StandardColor RAL "Blue grey" where color _ = color (RAL :: RAL 7031)-instance StandardColor RAL "Pebble grey" where color _ = color (RAL :: RAL 7032)-instance StandardColor RAL "Cement grey" where color _ = color (RAL :: RAL 7033)-instance StandardColor RAL "Yellow grey" where color _ = color (RAL :: RAL 7034)-instance StandardColor RAL "Light grey" where color _ = color (RAL :: RAL 7035)-instance StandardColor RAL "Platinum grey" where color _ = color (RAL :: RAL 7036)-instance StandardColor RAL "Dusty grey" where color _ = color (RAL :: RAL 7037)-instance StandardColor RAL "Agate grey" where color _ = color (RAL :: RAL 7038)-instance StandardColor RAL "Quartz grey" where color _ = color (RAL :: RAL 7039)-instance StandardColor RAL "Window grey" where color _ = color (RAL :: RAL 7040)-instance StandardColor RAL "Traffic grey A" where color _ = color (RAL :: RAL 7042)-instance StandardColor RAL "Traffic grey B" where color _ = color (RAL :: RAL 7043)-instance StandardColor RAL "Silk grey" where color _ = color (RAL :: RAL 7044)-instance StandardColor RAL "Telegrey 1" where color _ = color (RAL :: RAL 7045)-instance StandardColor RAL "Telegrey 2" where color _ = color (RAL :: RAL 7046)-instance StandardColor RAL "Telegrey 4" where color _ = color (RAL :: RAL 7047)-instance StandardColor RAL "Pearl mouse grey" where color _ = color (RAL :: RAL 7048)-instance StandardColor RAL "Green brown" where color _ = color (RAL :: RAL 8000)-instance StandardColor RAL "Ochre brown" where color _ = color (RAL :: RAL 8001)-instance StandardColor RAL "Signal brown" where color _ = color (RAL :: RAL 8002)-instance StandardColor RAL "Clay brown" where color _ = color (RAL :: RAL 8003)-instance StandardColor RAL "Copper brown" where color _ = color (RAL :: RAL 8004)-instance StandardColor RAL "Fawn brown" where color _ = color (RAL :: RAL 8007)-instance StandardColor RAL "Olive brown" where color _ = color (RAL :: RAL 8008)-instance StandardColor RAL "Nut brown" where color _ = color (RAL :: RAL 8011)-instance StandardColor RAL "Red brown" where color _ = color (RAL :: RAL 8012)-instance StandardColor RAL "Sepia brown" where color _ = color (RAL :: RAL 8014)-instance StandardColor RAL "Chestnut brown" where color _ = color (RAL :: RAL 8015)-instance StandardColor RAL "Mahogany brown" where color _ = color (RAL :: RAL 8016)-instance StandardColor RAL "Chocolate brown" where color _ = color (RAL :: RAL 8017)-instance StandardColor RAL "Grey brown" where color _ = color (RAL :: RAL 8019)-instance StandardColor RAL "Black brown" where color _ = color (RAL :: RAL 8022)-instance StandardColor RAL "Orange brown" where color _ = color (RAL :: RAL 8023)-instance StandardColor RAL "Beige brown" where color _ = color (RAL :: RAL 8024)-instance StandardColor RAL "Pale brown" where color _ = color (RAL :: RAL 8025)-instance StandardColor RAL "Terra brown" where color _ = color (RAL :: RAL 8028)-instance StandardColor RAL "Pearl copper" where color _ = color (RAL :: RAL 8029)-instance StandardColor RAL "Cream" where color _ = color (RAL :: RAL 9001)-instance StandardColor RAL "Grey white" where color _ = color (RAL :: RAL 9002)-instance StandardColor RAL "Signal white" where color _ = color (RAL :: RAL 9003)-instance StandardColor RAL "Signal black" where color _ = color (RAL :: RAL 9004)-instance StandardColor RAL "Jet black" where color _ = color (RAL :: RAL 9005)-instance StandardColor RAL "White aluminium" where color _ = color (RAL :: RAL 9006)-instance StandardColor RAL "Grey aluminium" where color _ = color (RAL :: RAL 9007)-instance StandardColor RAL "Pure white" where color _ = color (RAL :: RAL 9010)-instance StandardColor RAL "Graphite black" where color _ = color (RAL :: RAL 9011)-instance StandardColor RAL "Traffic white" where color _ = color (RAL :: RAL 9016)-instance StandardColor RAL "Traffic black" where color _ = color (RAL :: RAL 9017)-instance StandardColor RAL "Papyrus white" where color _ = color (RAL :: RAL 9018)-instance StandardColor RAL "Pearl light grey" where color _ = color (RAL :: RAL 9022)-instance StandardColor RAL "Pearl dark grey" where color _ = pearlDarkGrey --color (RAL :: RAL 9023)+instance StandardColor RAL "Green beige" where color _ = greenBeige+instance StandardColor RAL "Beige" where color _ = beige+instance StandardColor RAL "Sand yellow" where color _ = sandYellow+instance StandardColor RAL "Signal yellow" where color _ = signalYellow+instance StandardColor RAL "Golden yellow" where color _ = goldenYellow+instance StandardColor RAL "Honey yellow" where color _ = honeyYellow+instance StandardColor RAL "Maize yellow" where color _ = maizeYellow+instance StandardColor RAL "Daffodil yellow" where color _ = daffodilYellow+instance StandardColor RAL "Brown beige" where color _ = brownBeige+instance StandardColor RAL "Lemon yellow" where color _ = lemonYellow+instance StandardColor RAL "Oyster white" where color _ = oysterWhite+instance StandardColor RAL "Ivory" where color _ = ivory+instance StandardColor RAL "Light ivory" where color _ = lightIvory+instance StandardColor RAL "Sulfur yellow" where color _ = sulfurYellow+instance StandardColor RAL "Saffron yellow" where color _ = saffronYellow+instance StandardColor RAL "Zinc yellow" where color _ = zincYellow+instance StandardColor RAL "Grey beige" where color _ = greyBeige+instance StandardColor RAL "Olive yellow" where color _ = oliveYellow+instance StandardColor RAL "Rape yellow" where color _ = rapeYellow+instance StandardColor RAL "Traffic yellow" where color _ = trafficYellow+instance StandardColor RAL "Ochre yellow" where color _ = ochreYellow+instance StandardColor RAL "Luminous yellow" where color _ = luminousYellow+instance StandardColor RAL "Curry yellow" where color _ = curryYellow+instance StandardColor RAL "Melon yellow" where color _ = melonYellow+instance StandardColor RAL "Broom yellow" where color _ = broomYellow+instance StandardColor RAL "Dahlia yellow" where color _ = dahliaYellow+instance StandardColor RAL "Pastel yellow" where color _ = pastelYellow+instance StandardColor RAL "Pearl beige" where color _ = pearlBeige+instance StandardColor RAL "Pearl gold" where color _ = pearlGold+instance StandardColor RAL "Sun yellow" where color _ = sunYellow+instance StandardColor RAL "Yellow orange" where color _ = yellowOrange+instance StandardColor RAL "Red orange" where color _ = redOrange+instance StandardColor RAL "Vermilion" where color _ = vermilion+instance StandardColor RAL "Pastel orange" where color _ = pastelOrange+instance StandardColor RAL "Pure orange" where color _ = pureOrange+instance StandardColor RAL "Luminous orange" where color _ = luminousOrange+instance StandardColor RAL "Luminous bright orange" where color _ = luminousBrightOrange+instance StandardColor RAL "Bright red orange" where color _ = brightRedOrange+instance StandardColor RAL "Traffic orange" where color _ = trafficOrange+instance StandardColor RAL "Signal orange" where color _ = signalOrange+instance StandardColor RAL "Deep orange" where color _ = deepOrange+instance StandardColor RAL "Salmon orange" where color _ = salmonOrange+instance StandardColor RAL "Pearl orange" where color _ = pearlOrange+instance StandardColor RAL "Flame red" where color _ = flameRed+instance StandardColor RAL "Signal red" where color _ = signalRed+instance StandardColor RAL "Carmine red" where color _ = carmineRed+instance StandardColor RAL "Ruby red" where color _ = rubyRed+instance StandardColor RAL "Purple red" where color _ = purpleRed+instance StandardColor RAL "Wine red" where color _ = wineRed+instance StandardColor RAL "Black red" where color _ = blackRed+instance StandardColor RAL "Oxide red" where color _ = oxideRed+instance StandardColor RAL "Brown red" where color _ = brownRed+instance StandardColor RAL "Beige red" where color _ = beigeRed+instance StandardColor RAL "Tomato red" where color _ = tomatoRed+instance StandardColor RAL "Antique pink" where color _ = antiquePink+instance StandardColor RAL "Light pink" where color _ = lightPink+instance StandardColor RAL "Coral red" where color _ = coralRed+instance StandardColor RAL "Rose" where color _ = rose+instance StandardColor RAL "Strawberry red" where color _ = strawberryRed+instance StandardColor RAL "Traffic red" where color _ = trafficRed+instance StandardColor RAL "Salmon pink" where color _ = salmonPink+instance StandardColor RAL "Luminous red" where color _ = luminousRed+instance StandardColor RAL "Luminous bright red" where color _ = luminousBrightRed+instance StandardColor RAL "Raspberry red" where color _ = raspberryRed+instance StandardColor RAL "Pure red" where color _ = pureRed+instance StandardColor RAL "Orient red" where color _ = orientRed+instance StandardColor RAL "Pearl ruby red" where color _ = pearlRubyRed+instance StandardColor RAL "Pearl pink" where color _ = pearlPink+instance StandardColor RAL "Red lilac" where color _ = redLilac+instance StandardColor RAL "Red violet" where color _ = redViolet+instance StandardColor RAL "Heather violet" where color _ = heatherViolet+instance StandardColor RAL "Claret violet" where color _ = claretViolet+instance StandardColor RAL "Blue lilac" where color _ = blueLilac+instance StandardColor RAL "Traffic purple" where color _ = trafficPurple+instance StandardColor RAL "Purple violet" where color _ = purpleViolet+instance StandardColor RAL "Signal violet" where color _ = signalViolet+instance StandardColor RAL "Pastel violet" where color _ = pastelViolet+instance StandardColor RAL "Telemagenta" where color _ = telemagenta+instance StandardColor RAL "Pearl violet" where color _ = pearlViolet+instance StandardColor RAL "Pearl blackberry" where color _ = pearlBlackberry+instance StandardColor RAL "Violet blue" where color _ = violetBlue+instance StandardColor RAL "Green blue" where color _ = greenBlue+instance StandardColor RAL "Ultramarine blue" where color _ = ultramarineBlue+instance StandardColor RAL "Sapphire blue" where color _ = sapphireBlue+instance StandardColor RAL "Black blue" where color _ = blackBlue+instance StandardColor RAL "Signal blue" where color _ = signalBlue+instance StandardColor RAL "Brilliant blue" where color _ = brilliantBlue+instance StandardColor RAL "Grey blue" where color _ = greyBlue+instance StandardColor RAL "Azure blue" where color _ = azureBlue+instance StandardColor RAL "Gentian blue" where color _ = gentianBlue+instance StandardColor RAL "Steel blue" where color _ = steelBlue+instance StandardColor RAL "Light blue" where color _ = lightBlue+instance StandardColor RAL "Cobalt blue" where color _ = cobaltBlue+instance StandardColor RAL "Pigeon blue" where color _ = pigeonBlue+instance StandardColor RAL "Sky blue" where color _ = skyBlue+instance StandardColor RAL "Traffic blue" where color _ = trafficBlue+instance StandardColor RAL "Turquoise blue" where color _ = turquoiseBlue+instance StandardColor RAL "Capri blue" where color _ = capriBlue+instance StandardColor RAL "Ocean blue" where color _ = oceanBlue+instance StandardColor RAL "Water blue" where color _ = waterBlue+instance StandardColor RAL "Night blue" where color _ = nightBlue+instance StandardColor RAL "Distant blue" where color _ = distantBlue+instance StandardColor RAL "Pastel blue" where color _ = pastelBlue+instance StandardColor RAL "Pearl gentian blue" where color _ = pearlGentianBlue+instance StandardColor RAL "Pearl night blue" where color _ = pearlNightBlue+instance StandardColor RAL "Patina green" where color _ = patinaGreen+instance StandardColor RAL "Emerald green" where color _ = emeraldGreen+instance StandardColor RAL "Leaf green" where color _ = leafGreen+instance StandardColor RAL "Olive green" where color _ = oliveGreen+instance StandardColor RAL "Blue green" where color _ = blueGreen+instance StandardColor RAL "Moss green" where color _ = mossGreen+instance StandardColor RAL "Grey olive" where color _ = greyOlive+instance StandardColor RAL "Bottle green" where color _ = bottleGreen+instance StandardColor RAL "Brown green" where color _ = brownGreen+instance StandardColor RAL "Fir green" where color _ = firGreen+instance StandardColor RAL "Grass green" where color _ = grassGreen+instance StandardColor RAL "Reseda green" where color _ = resedaGreen+instance StandardColor RAL "Black green" where color _ = blackGreen+instance StandardColor RAL "Reed green" where color _ = reedGreen+instance StandardColor RAL "Yellow olive" where color _ = yellowOlive+instance StandardColor RAL "Black olive" where color _ = blackOlive+instance StandardColor RAL "Turquoise green" where color _ = turquoiseGreen+instance StandardColor RAL "May green" where color _ = mayGreen+instance StandardColor RAL "Yellow green" where color _ = yellowGreen+instance StandardColor RAL "Pastel green" where color _ = pastelGreen+instance StandardColor RAL "Chrome green" where color _ = chromeGreen+instance StandardColor RAL "Pale green" where color _ = paleGreen+instance StandardColor RAL "Olive-drab" where color _ = oliveDrab+-- | Synonym for `oliveDrab`+instance StandardColor RAL "Brown olive" where color _ = oliveDrab+instance StandardColor RAL "Traffic green" where color _ = trafficGreen+instance StandardColor RAL "Fern green" where color _ = fernGreen+instance StandardColor RAL "Opal green" where color _ = opalGreen+instance StandardColor RAL "Light green" where color _ = lightGreen+instance StandardColor RAL "Pine green" where color _ = pineGreen+instance StandardColor RAL "Mint green" where color _ = mintGreen+instance StandardColor RAL "Signal green" where color _ = signalGreen+instance StandardColor RAL "Mint turquoise" where color _ = mintTurquoise+instance StandardColor RAL "Pastel turquoise" where color _ = pastelTurquoise+instance StandardColor RAL "Pearl green" where color _ = pearlGreen+instance StandardColor RAL "Pearl opal green" where color _ = pearlOpalGreen+instance StandardColor RAL "Pure green" where color _ = pureGreen+instance StandardColor RAL "Luminous green" where color _ = luminousGreen+instance StandardColor RAL "Squirrel grey" where color _ = squirrelGrey+instance StandardColor RAL "Silver grey" where color _ = silverGrey+instance StandardColor RAL "Olive grey" where color _ = oliveGrey+instance StandardColor RAL "Moss grey" where color _ = mossGrey+instance StandardColor RAL "Signal grey" where color _ = signalGrey+instance StandardColor RAL "Mouse grey" where color _ = mouseGrey+instance StandardColor RAL "Beige grey" where color _ = beigeGrey+instance StandardColor RAL "Khaki grey" where color _ = khakiGrey+instance StandardColor RAL "Green grey" where color _ = greenGrey+instance StandardColor RAL "Tarpaulin grey" where color _ = tarpaulinGrey+instance StandardColor RAL "Iron grey" where color _ = ironGrey+instance StandardColor RAL "Basalt grey" where color _ = basaltGrey+instance StandardColor RAL "Brown grey" where color _ = brownGrey+instance StandardColor RAL "NATO olive" where color _ = brownGrey+instance StandardColor RAL "Slate grey" where color _ = slateGrey+instance StandardColor RAL "Anthracite grey" where color _ = anthraciteGrey+instance StandardColor RAL "Black grey" where color _ = blackGrey+instance StandardColor RAL "Umbra grey" where color _ = umbraGrey+instance StandardColor RAL "Concrete grey" where color _ = concreteGrey+instance StandardColor RAL "Graphite grey" where color _ = graphiteGrey+instance StandardColor RAL "Granite grey" where color _ = graniteGrey+instance StandardColor RAL "Stone grey" where color _ = stoneGrey+instance StandardColor RAL "Blue grey" where color _ = blueGrey+instance StandardColor RAL "Pebble grey" where color _ = pebbleGrey+instance StandardColor RAL "Cement grey" where color _ = cementGrey+instance StandardColor RAL "Yellow grey" where color _ = yellowGrey+instance StandardColor RAL "Light grey" where color _ = lightGrey+instance StandardColor RAL "Platinum grey" where color _ = platinumGrey+instance StandardColor RAL "Dusty grey" where color _ = dustyGrey+instance StandardColor RAL "Agate grey" where color _ = agateGrey+instance StandardColor RAL "Quartz grey" where color _ = quartzGrey+instance StandardColor RAL "Window grey" where color _ = windowGrey+instance StandardColor RAL "Traffic grey A" where color _ = trafficGreyA+instance StandardColor RAL "Traffic grey B" where color _ = trafficGreyB+instance StandardColor RAL "Silk grey" where color _ = silkGrey+instance StandardColor RAL "Telegrey 1" where color _ = telegrey1+instance StandardColor RAL "Telegrey 2" where color _ = telegrey2+instance StandardColor RAL "Telegrey 4" where color _ = telegrey4+instance StandardColor RAL "Pearl mouse grey" where color _ = pearlMouseGrey+instance StandardColor RAL "Green brown" where color _ = greenBrown+instance StandardColor RAL "Ochre brown" where color _ = ochreBrown+instance StandardColor RAL "Signal brown" where color _ = signalBrown+instance StandardColor RAL "Clay brown" where color _ = clayBrown+instance StandardColor RAL "Copper brown" where color _ = copperBrown+instance StandardColor RAL "Fawn brown" where color _ = fawnBrown+instance StandardColor RAL "Olive brown" where color _ = oliveBrown+instance StandardColor RAL "Nut brown" where color _ = nutBrown+instance StandardColor RAL "Red brown" where color _ = redBrown+instance StandardColor RAL "Sepia brown" where color _ = sepiaBrown+instance StandardColor RAL "Chestnut brown" where color _ = chestnutBrown+instance StandardColor RAL "Mahogany brown" where color _ = mahoganyBrown+instance StandardColor RAL "Chocolate brown" where color _ = chocolateBrown+instance StandardColor RAL "Grey brown" where color _ = greyBrown+instance StandardColor RAL "Black brown" where color _ = blackBrown+instance StandardColor RAL "Orange brown" where color _ = orangeBrown+instance StandardColor RAL "Beige brown" where color _ = beigeBrown+instance StandardColor RAL "Pale brown" where color _ = paleBrown+instance StandardColor RAL "Terra brown" where color _ = terraBrown+instance StandardColor RAL "Pearl copper" where color _ = pearlCopper+instance StandardColor RAL "Cream" where color _ = cream+instance StandardColor RAL "Grey white" where color _ = greyWhite+instance StandardColor RAL "Signal white" where color _ = signalWhite+instance StandardColor RAL "Signal black" where color _ = signalBlack+instance StandardColor RAL "Jet black" where color _ = jetBlack+instance StandardColor RAL "White aluminium" where color _ = whiteAluminium+instance StandardColor RAL "Grey aluminium" where color _ = greyAluminium+instance StandardColor RAL "Pure white" where color _ = pureWhite+instance StandardColor RAL "Graphite black" where color _ = graphiteBlack+instance StandardColor RAL "Traffic white" where color _ = trafficWhite+instance StandardColor RAL "Traffic black" where color _ = trafficBlack+instance StandardColor RAL "Papyrus white" where color _ = papyrusWhite+instance StandardColor RAL "Pearl light grey" where color _ = pearlLightGrey+instance StandardColor RAL "Pearl dark grey" where color _ = pearlDarkGrey
+ tests/Graphics/Color/Illuminant/WikipediaSpec.hs view
@@ -0,0 +1,56 @@+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE AllowAmbiguousTypes #-}+module Graphics.Color.Illuminant.WikipediaSpec (spec) where++import Data.Proxy+import Graphics.Color.Space.Common+import Graphics.Color.Illuminant.Wikipedia+import qualified Data.Colour.CIE as Colour+import qualified Data.Colour.CIE.Illuminant as Colour++shouldMatch ::+ forall i. Illuminant i+ => (Double, Double, Double)+ -> WhitePoint i Double+ -> Spec+shouldMatch (x, y, _) wp =+ let (x', y', z') = (xWhitePoint wp, yWhitePoint wp, zWhitePoint wp)+ in it (showsType (Proxy :: Proxy (WhitePoint i Double)) "") $ do+ x `shouldBe` x'+ y `shouldBe` y'+ epsilonExpect 1e-15 1 (x' + y' + z')++instance Arbitrary Degree2 where+ arbitrary = arbitraryBoundedEnum++spec :: Spec+spec =+ describe "Wikipedia" $ do+ describe "Match 'colour' package" $ do+ Colour.chromaCoords Colour.a `shouldMatch` (whitePoint :: WhitePoint 'A Double)+ Colour.chromaCoords Colour.b `shouldMatch` (whitePoint :: WhitePoint 'B Double)+ Colour.chromaCoords Colour.c `shouldMatch` (whitePoint :: WhitePoint 'C Double)+ Colour.chromaCoords Colour.d50 `shouldMatch` (whitePoint :: WhitePoint 'D50 Double)+ Colour.chromaCoords Colour.d55 `shouldMatch` (whitePoint :: WhitePoint 'D55 Double)+ Colour.chromaCoords Colour.d65 `shouldMatch` (whitePoint :: WhitePoint 'D65 Double)+ Colour.chromaCoords Colour.d75 `shouldMatch` (whitePoint :: WhitePoint 'D75 Double)+ Colour.chromaCoords Colour.e `shouldMatch` (whitePoint :: WhitePoint 'E Double)+ Colour.chromaCoords Colour.f1 `shouldMatch` (whitePoint :: WhitePoint 'F1 Double)+ Colour.chromaCoords Colour.f2 `shouldMatch` (whitePoint :: WhitePoint 'F2 Double)+ Colour.chromaCoords Colour.f3 `shouldMatch` (whitePoint :: WhitePoint 'F3 Double)+ Colour.chromaCoords Colour.f4 `shouldMatch` (whitePoint :: WhitePoint 'F4 Double)+ Colour.chromaCoords Colour.f5 `shouldMatch` (whitePoint :: WhitePoint 'F5 Double)+ Colour.chromaCoords Colour.f6 `shouldMatch` (whitePoint :: WhitePoint 'F6 Double)+ Colour.chromaCoords Colour.f7 `shouldMatch` (whitePoint :: WhitePoint 'F7 Double)+ Colour.chromaCoords Colour.f8 `shouldMatch` (whitePoint :: WhitePoint 'F8 Double)+ Colour.chromaCoords Colour.f9 `shouldMatch` (whitePoint :: WhitePoint 'F9 Double)+ Colour.chromaCoords Colour.f10 `shouldMatch` (whitePoint :: WhitePoint 'F10 Double)+ Colour.chromaCoords Colour.f11 `shouldMatch` (whitePoint :: WhitePoint 'F11 Double)+ Colour.chromaCoords Colour.f12 `shouldMatch` (whitePoint :: WhitePoint 'F12 Double)+ describe "Derived Classes" $ do+ it "Bounded" $ [minBound .. maxBound] `shouldBe` [A .. F12]+ prop "Enum" $ \ (i :: Degree2) -> toEnum (fromEnum i) === i+ prop "Read . Show" $ \ (i :: Degree2) -> read (show i) === i+ prop "Read . Show" $ \ is -> read (show is) === (is :: [Degree2])
tests/Graphics/Color/Model/Common.hs view
@@ -14,6 +14,8 @@ , epsilonColorIxSpec , epsilonEq , epsilonEqColor+ , epsilonEqColorFloat+ , epsilonEqColorDouble , epsilonEqColorTol , epsilonEqColorTolIx , arbitraryElevator@@ -34,6 +36,7 @@ import Test.QuickCheck import Control.Monad + izipWithM_ :: Applicative m => (Int -> a -> b -> m c) -> [a] -> [b] -> m () izipWithM_ f xs = zipWithM_ (uncurry f) (zip [0..] xs) @@ -63,7 +66,9 @@ | isNaN x = y `shouldSatisfy` isNaN | x == y = pure () | otherwise =- assertBool (concat [show x, " /= ", show y, "\nTolerance: ", show diff, " > ", show n]) (diff <= n)+ assertBool+ (concat [show x, " /= ", show y, "\nTolerance: ", show diff, " > ", show n])+ (diff <= n) where (absx, absy) = (abs x, abs y) n = epsilon * (1 + max absx absy)@@ -96,6 +101,17 @@ epsilonEqColor = epsilonEqColorTol epsilon where epsilon = 1e-11++epsilonEqColorDouble :: ColorModel cs Double => Color cs Double -> Color cs Double -> Property+epsilonEqColorDouble = epsilonEqColorTol epsilon+ where+ epsilon = 1e-12+++epsilonEqColorFloat :: ColorModel cs Float => Color cs Float -> Color cs Float -> Property+epsilonEqColorFloat = epsilonEqColorTol epsilon+ where+ epsilon = 1e-6 epsilonEqColorTol :: (ColorModel cs e, RealFloat e) => e -> Color cs e -> Color cs e -> Property epsilonEqColorTol epsilon x y = conjoin $ F.toList $ liftA2 (epsilonEq epsilon) x y
tests/Graphics/Color/Model/HSLSpec.hs view
@@ -8,6 +8,9 @@ import Graphics.Color.Model.Common import Graphics.Color.Model.RGBSpec (rgbs) +import qualified Data.Colour.RGBSpace as Colour+import qualified Data.Colour.RGBSpace.HSL as Colour+ instance (Elevator e, Random e) => Arbitrary (Color HSL e) where arbitrary = ColorHSL <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator @@ -23,6 +26,13 @@ let tol = 2e-3 describe "rgb2hsl" $ izipWithM_ (epsilonColorIxSpec tol) hsls (rgb2hsl <$> rgbs) describe "hsl2rgb" $ izipWithM_ (epsilonColorIxSpec tol) rgbs (hsl2rgb <$> hsls)+ describe "Same as colour package" $ do+ prop "rgb2hsl" $ \ rgb@(ColorRGB r g b) ->+ case Colour.hslView (Colour.RGB r g b) of+ (h, s, l) -> rgb2hsl rgb `epsilonEqColorFloat` ColorH360SL h s l+ prop "hsl2rgb" $ \ hsl@(ColorH360SL h s l) ->+ case Colour.hsl h s l of+ Colour.RGB r g b -> hsl2rgb hsl `epsilonEqColorFloat` ColorRGB r g b hsls :: [Color HSL Double]
tests/Graphics/Color/Model/HSVSpec.hs view
@@ -7,6 +7,9 @@ import Graphics.Color.Model.Common import Graphics.Color.Model.RGBSpec (rgbs) +import qualified Data.Colour.RGBSpace as Colour+import qualified Data.Colour.RGBSpace.HSV as Colour+ instance (Elevator e, Random e) => Arbitrary (Color HSV e) where arbitrary = ColorHSV <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator @@ -22,6 +25,13 @@ let tol = 1e-3 describe "rgb2hsv" $ izipWithM_ (epsilonColorIxSpec tol) hsvs (rgb2hsv <$> rgbs) describe "hsv2rgb" $ izipWithM_ (epsilonColorIxSpec tol) rgbs (hsv2rgb <$> hsvs)+ describe "Same as colour package" $ do+ prop "rgb2hsv" $ \ rgb@(ColorRGB r g b) ->+ case Colour.hsvView (Colour.RGB r g b) of+ (h, s, v) -> rgb2hsv rgb `epsilonEqColorFloat` ColorH360SV h s v+ prop "hsv2rgb" $ \ hsv@(ColorH360SV h s v) ->+ case Colour.hsv h s v of+ Colour.RGB r g b -> hsv2rgb hsv `epsilonEqColorFloat` ColorRGB r g b hsvs :: [Color HSV Double]
− tests/Graphics/Color/Space/CIE1931/IlluminantSpec.hs
@@ -1,50 +0,0 @@-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE KindSignatures #-}-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE AllowAmbiguousTypes #-}-module Graphics.Color.Space.CIE1931.IlluminantSpec (spec) where--import Data.Proxy-import Graphics.Color.Space.Common-import Graphics.Color.Illuminant.CIE1931 as CIE1931-import qualified Data.Colour.CIE as Colour-import qualified Data.Colour.CIE.Illuminant as Colour--shouldMatchApprox ::- forall i. Illuminant (i :: k)- => (Double, Double, Double)- -> WhitePoint i Double- -> Spec-shouldMatchApprox (x, y, _) wp =- let (x', y', z') = (xWhitePoint wp, yWhitePoint wp, zWhitePoint wp)- eps = 1e-3 -- This is rather unfortunate, but it seems that "colour" package authors- -- decided to go with the values from wikipedia, rather than from the- -- document created by CIE: Technical Report: Colorimetry, 3rd edition- in prop (showsType (Proxy :: Proxy (WhitePoint i Double)) "") $ once $- epsilonEq eps x x' .&&. epsilonEq eps y y' .&&. epsilonEq 1e-12 1 (x' + y' + z')--spec :: Spec-spec =- describe "Illuminants" $- describe "ColourMatch" $ do- Colour.chromaCoords Colour.a `shouldMatchApprox` (whitePoint :: WhitePoint 'A Double)- Colour.chromaCoords Colour.b `shouldMatchApprox` (whitePoint :: WhitePoint 'B Double)- Colour.chromaCoords Colour.c `shouldMatchApprox` (whitePoint :: WhitePoint 'C Double)- Colour.chromaCoords Colour.d50 `shouldMatchApprox` (whitePoint :: WhitePoint 'D50 Double)- Colour.chromaCoords Colour.d55 `shouldMatchApprox` (whitePoint :: WhitePoint 'D55 Double)- Colour.chromaCoords Colour.d65 `shouldMatchApprox` (whitePoint :: WhitePoint 'CIE1931.D65 Double)- Colour.chromaCoords Colour.d75 `shouldMatchApprox` (whitePoint :: WhitePoint 'D75 Double)- Colour.chromaCoords Colour.e `shouldMatchApprox` (whitePoint :: WhitePoint 'E Double)- Colour.chromaCoords Colour.f1 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL1 Double)- Colour.chromaCoords Colour.f2 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL2 Double)- Colour.chromaCoords Colour.f3 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL3 Double)- Colour.chromaCoords Colour.f4 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL4 Double)- Colour.chromaCoords Colour.f5 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL5 Double)- Colour.chromaCoords Colour.f6 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL6 Double)- Colour.chromaCoords Colour.f7 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL7 Double)- Colour.chromaCoords Colour.f8 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL8 Double)- Colour.chromaCoords Colour.f9 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL9 Double)- Colour.chromaCoords Colour.f10 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL10 Double)- Colour.chromaCoords Colour.f11 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL11 Double)- Colour.chromaCoords Colour.f12 `shouldMatchApprox` (whitePoint :: WhitePoint 'FL12 Double)
tests/Graphics/Color/Space/CIE1976/LABSpec.hs view
@@ -1,13 +1,20 @@-{-# LANGUAGE PolyKinds #-}-{-# LANGUAGE KindSignatures #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} module Graphics.Color.Space.CIE1976.LABSpec (spec) where -import Graphics.Color.Space.Common+import qualified Data.Colour.CIE as Colour+import qualified Data.Colour.CIE.Illuminant as Colour+import qualified Data.Colour.SRGB as Colour import Graphics.Color.Illuminant.CIE1931 as I2+import qualified Graphics.Color.Illuminant.Wikipedia as W import Graphics.Color.Space.CIE1976.LAB+import Graphics.Color.Space.Common+import Graphics.Color.Space.RGB.Derived.SRGBSpec ()+import Graphics.Color.Space.RGB.Derived.SRGB instance (Elevator e, Random e, Illuminant i) => Arbitrary (Color (LAB (i :: k)) e) where arbitrary = ColorLAB <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator@@ -16,6 +23,14 @@ spec :: Spec spec = describe "LAB" $ do colorModelSpec @(LAB 'D65) @Word "LAB"- prop "toFromColorXYZ" (prop_toFromColorXYZ :: Color (LAB 'D65) Double -> Property)- prop "toFromColorSpace" (prop_toFromColorSpace :: Color (LAB 'D65) Double -> Property)-+ colorSpaceLenientSpec @(LAB 'D65) @_ @Double 1e-10+ describe "Same as colour package" $ do+ prop "lab2srgb" $ \lab@(ColorLAB l' a' b' :: Color (LAB 'W.D65) Double) ->+ case Colour.toSRGB (Colour.cieLAB Colour.d65 l' a' b') of+ Colour.RGB r g b ->+ (convertColor lab :: Color (SRGB 'W.D65) Double)+ `epsilonEqColorDouble` ColorRGB r g b+ prop "srgb2xlab" $ \rgb@(ColorRGB r g b :: Color (SRGB 'W.D65) Double) ->+ case Colour.cieLABView Colour.d65 (Colour.sRGB r g b) of+ (l', a', b') ->+ convertColor rgb `epsilonEqColorDouble` (ColorLAB l' a' b' :: Color (LAB 'W.D65) Double)
tests/Graphics/Color/Space/Common.hs view
@@ -1,25 +1,34 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE KindSignatures #-} {-# LANGUAGE PolyKinds #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TypeApplications #-} module Graphics.Color.Space.Common ( module Graphics.Color.Space , module Graphics.Color.Model.Common+ , colorSpaceSpec+ , colorSpaceLenientSpec , prop_toFromColorXYZ , prop_toFromLenientColorXYZ- , prop_toFromColorSpace+ , prop_toFromBaseSpace ) where import Graphics.Color.Space import Graphics.Color.Model.Common +instance (Elevator e, Random e) => Arbitrary (Color (Y i) e) where+ arbitrary = Y <$> arbitraryElevator +instance (Elevator e, Random e) => Arbitrary (Color (XYZ i) e) where+ arbitrary = ColorXYZ <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator++ prop_toFromColorXYZ ::- forall cs i e. (ColorSpace cs (i :: k) e, RealFloat e)+ forall cs i e. (ColorSpace cs i e, RealFloat e) => Color cs e -> Property-prop_toFromColorXYZ px = px `epsilonEqColor` fromColorXYZ (toColorXYZ px :: Color (XYZ i) Double)+prop_toFromColorXYZ c = c `epsilonEqColor` fromColorXYZ (toColorXYZ c :: Color (XYZ i) Double) -- For RGB standards, that have matrices rounded to 4 digits after the decimal point@@ -28,13 +37,49 @@ => e -> Color cs e -> Property-prop_toFromLenientColorXYZ epsilon px =- epsilonEqColorTol epsilon px (fromColorXYZ (toColorXYZ px :: Color (XYZ i) Double))+prop_toFromLenientColorXYZ epsilon c =+ epsilonEqColorTol epsilon c (fromColorXYZ (toColorXYZ c :: Color (XYZ i) Double)) -prop_toFromColorSpace ::+prop_toFromBaseSpace :: forall cs i e. (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, RealFloat e) => Color cs e -> Property-prop_toFromColorSpace px = px `epsilonEqColor` fromBaseSpace (toBaseSpace px)+prop_toFromBaseSpace c = c `epsilonEqColor` fromBaseSpace (toBaseSpace c) +prop_toFromBaseModel ::+ forall cs i e. ColorSpace cs i e+ => Color cs e+ -> Property+prop_toFromBaseModel c = c === fromBaseModel (toBaseModel c)++colorSpaceCommonSpec ::+ forall cs i e.+ (Arbitrary (Color cs e), ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, RealFloat e)+ => Spec -> Spec+colorSpaceCommonSpec extra =+ describe "ColorSpace" $ do+ prop "luminance . toColorXYZ" $ \(c :: Color cs e) ->+ (luminance c :: Color (Y i) Float) `epsilonEqColor`+ luminance (toColorXYZ c :: Color (XYZ i) Float)+ prop "toFromBaseModel" $ prop_toFromBaseModel @cs @i @e+ prop "toFromBaseSpace" $ prop_toFromBaseSpace @cs @i @e+ extra++colorSpaceSpec ::+ forall cs i e.+ (Arbitrary (Color cs e), ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, RealFloat e)+ => Spec+colorSpaceSpec =+ colorSpaceCommonSpec @cs @i @e $+ prop "toFromColorXYZ" $ prop_toFromColorXYZ @cs @i @e++colorSpaceLenientSpec ::+ forall cs i e.+ (Arbitrary (Color cs e), ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, RealFloat e)+ => e+ -> Spec+colorSpaceLenientSpec tol =+ let tolStr = "(lenient=" ++ show tol ++ ")"+ in colorSpaceCommonSpec @cs @i @e $+ prop ("toFromColorXYZ " ++ tolStr) $ prop_toFromLenientColorXYZ @cs @i @e tol
tests/Graphics/Color/Space/RGB/Derived/SRGBSpec.hs view
@@ -6,8 +6,12 @@ {-# LANGUAGE TypeApplications #-} module Graphics.Color.Space.RGB.Derived.SRGBSpec (spec) where -import Graphics.Color.Space.Common+import qualified Data.Colour.CIE as Colour+import qualified Data.Colour.SRGB as Colour+import qualified Data.Colour.SRGB.Linear as Colour import Graphics.Color.Illuminant.CIE1931+import qualified Graphics.Color.Illuminant.Wikipedia as W+import Graphics.Color.Space.Common import Graphics.Color.Space.RGB.Derived.SRGB instance (Elevator e, Random e, Illuminant i) => Arbitrary (Color (SRGB (i :: k)) e) where@@ -17,5 +21,22 @@ spec :: Spec spec = describe "SRGB" $ do colorModelSpec @(SRGB 'D65) @Word "SRGB"- prop "toFromColorXYZ" (prop_toFromColorXYZ :: Color (SRGB 'D65) Double -> Property)- prop "toFromColorSpace" (prop_toFromColorSpace :: Color (SRGB 'D65) Double -> Property)+ colorSpaceSpec @(SRGB 'D65) @_ @Float+ describe "Same as colour package" $ do+ prop "xyz2srgb" $ \xyz@(ColorXYZ x y z :: Color (XYZ 'W.D65) Double) ->+ case Colour.toSRGB (Colour.cieXYZ x y z) of+ Colour.RGB r g b ->+ (fromColorXYZ xyz :: Color (SRGB 'W.D65) Double) `epsilonEqColorDouble` ColorRGB r g b+ prop "xyz2linearsrgb" $ \xyz@(ColorXYZ x y z :: Color (XYZ 'W.D65) Double) ->+ case Colour.toRGB (Colour.cieXYZ x y z) of+ Colour.RGB r g b ->+ dcctf (fromColorXYZ xyz :: Color (SRGB 'W.D65) Double) `epsilonEqColorDouble`+ ColorRGB r g b+ prop "srgb2xyz" $ \rgb@(ColorRGB r g b :: Color (SRGB 'W.D65) Double) ->+ case Colour.cieXYZView (Colour.sRGB r g b) of+ (x, y, z) ->+ toColorXYZ rgb `epsilonEqColorDouble` ColorXYZ x y z+ prop "linersrgb2xyz" $ \rgb@(ColorRGB r g b :: Color (SRGB 'W.D65) Double) ->+ case Colour.cieXYZView (Colour.rgb r g b) of+ (x, y, z) ->+ toColorXYZ (ecctf rgb) `epsilonEqColorDouble` ColorXYZ x y z
tests/Graphics/Color/Space/RGB/ITU/Rec709Spec.hs view
@@ -15,6 +15,4 @@ spec = describe "Rec709" $ do colorModelSpec @BT709 @Word "BT709" -- Roundrtrip is not always very accurate, eg: 8.115324539550295e-2 /= 8.140132075907752e-2- prop "toFromColorXYZ (lenient)" $- prop_toFromLenientColorXYZ @BT709 @_ @Double 5e-4- prop "toFromColorSpace" $ prop_toFromColorSpace @BT709 @_ @Double+ colorSpaceLenientSpec @BT709 @_ @Float 5e-4
tests/Graphics/Color/Space/RGB/SRGBSpec.hs view
@@ -12,5 +12,4 @@ spec :: Spec spec = describe "SRGB" $ do colorModelSpec @SRGB @Word "SRGB"- prop "toFromColorXYZ (lenient)" $ prop_toFromLenientColorXYZ @SRGB @_ @Double 0.001- prop "toFromColorSpace" $ prop_toFromColorSpace @SRGB @_ @Double+ colorSpaceLenientSpec @SRGB @_ @Float 0.001
tests/Graphics/Color/Standard/RALSpec.hs view
@@ -51,12 +51,15 @@ when (rname `elem` pendingNames) $ pendingWith "Some discrepancy" (expect received expected) zipWithM_ mkTest expectedColors receivedColors+ it "Color ShowS" $ do+ show (RAL :: RAL "GreenBeige") `shouldBe` "RAL \"GreenBeige\""+ show (Just (RAL :: RAL "GreenBeige")) `shouldBe` "Just (RAL \"GreenBeige\")" it "Color code matches" $ matchListsWith matchColor ralsLAB (toColorRAL ralColorCodes) it "Color name matches" $ matchListsWith matchColor ralsLAB (toColorRAL ralColorNames)- let (srgbs, hsls, _cmyks) = unzip3 ralAlternatives+ let (srgbs, _hsls, _cmyks) = unzip3 ralAlternatives describe "Matches sRGB" $ specMatchLists ["luminousBrightOrange", "pastelGreen"] shouldBe srgbs ralColors'- xdescribe "Matches HSL" $ specMatchLists [] shouldBe hsls ralColors'+ -- xdescribe "Matches HSL" $ specMatchLists [] shouldBe hsls ralColors' @@ -210,6 +213,7 @@ , RAL "Pastel green" , RAL "Chrome green" , RAL "Pale green"+ , RAL "Olive-drab" , RAL "Brown olive" , RAL "Traffic green" , RAL "Fern green"@@ -513,6 +517,7 @@ RAL :> RAL :> RAL :>+ RAL :> HNil @@ -646,6 +651,7 @@ , RAL 6020 , RAL 6021 , RAL 6022+ , RAL 6022 -- Synonym: Brown olive , RAL 6024 , RAL 6025 , RAL 6026@@ -948,6 +954,7 @@ RAL :> RAL :> RAL :>+ RAL :> HNil -- Duplicates are marked by the boolean true.@@ -1081,6 +1088,7 @@ , ("chromeGreen", chromeGreen, False) , ("paleGreen", paleGreen, False) , ("oliveDrab", oliveDrab, False)+ , ("brownOlive", oliveDrab, True) , ("trafficGreen", trafficGreen, False) , ("fernGreen", fernGreen, False) , ("opalGreen", opalGreen, False)