Skip to content

Instantly share code, notes, and snippets.

@melrief
Last active December 20, 2015 14:58
Show Gist options
  • Save melrief/6150234 to your computer and use it in GitHub Desktop.
Save melrief/6150234 to your computer and use it in GitHub Desktop.
import Data.Colour.RGBSpace.HSV (RGB, hsv)
nextColor :: (RealFrac a) => a -> a -> a -> (RGB a,a)
nextColor h s v = let h' = (h + golden_ratio_conjugate) % 360
in (hsv h' s v,h')
where golden_ratio_conjugate = 222.4922359499622 -- 0.618033988749895 * 360
dividend % divisor = dividend - divisor *
(fromIntegral $ floor (dividend/divisor))
goldenColors :: (RealFrac a) => a -> a -> a -> [RGB a]
goldenColors h s v = let (c,h') = nextColor h s v
in c:goldenColors h' s v
-- note: to use a HSV.RBG value as Color you can convert it using uncurryRGB sRGB color3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment