Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Arbitrary instances for color spaces / models with unusual coordinate ranges #6

Open
gilgamec opened this issue May 13, 2021 · 1 comment

Comments

@gilgamec
Copy link
Contributor

I noticed that the test specifications for e.g. LAB use the same Abritrary instance as others:

instance (Elevator e, Random e, Illuminant i) => Arbitrary (Color (LAB (i :: k)) e) where
  arbitrary = ColorLAB <$> arbitraryElevator <*> arbitraryElevator <*> arbitraryElevator

where arbitraryElevator gives either the full range of values (for discrete quanta like Word8) or the range [0,1] for Float and Double. However, LAB at least (and possibly others) uses a different range: L can go from 0 to 100, while a and b vary in a similar range, depending on L, and can also be negative. Thus, right now the spec tests are only checking colors very close to black. I'm not sure how this can be handled within QuickCheck.

@lehins
Copy link
Owner

lehins commented May 14, 2021

You are absolutely right about this. We need a new concept of min max values on per channel basis, which has to be at the ColorModel level in order to get this done properly. Arbitrary instance however can be fixed before we get it figure out a proper solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants