/
Harmonic.purs
54 lines (47 loc) · 1.06 KB
/
Harmonic.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Color.Scheme.Harmonic
( shades
, analogous
, triad
, splitComplementary
, tetrad
) where
import Prelude
import Color (Color, rotateHue, darken, lighten)
-- | The given color plus a lighter and darker variant.
shades :: Color -> Array Color
shades c =
[ lighten 0.2 c
, c
, darken 0.2 c
]
-- | Three colors, separated by 30° in hue and centered around the given
-- | color.
analogous :: Color -> Array Color
analogous c =
[ rotateHue (-30.0) c
, c
, rotateHue 30.0 c
]
-- | Three colors that are evenly spaced along the HSL color wheel.
triad :: Color -> Array Color
triad c =
[ c
, rotateHue (-120.0) c
, rotateHue 120.0 c
]
-- | The given color and two complementary colors, split by 30°.
splitComplementary :: Color -> Array Color
splitComplementary c =
[ c
, rotateHue (-165.0) c
, rotateHue 165.0 c
]
-- | Four colors that come in groups of two pairs which are on opposite sides
-- | of the color wheel.
tetrad :: Color -> Array Color
tetrad c =
[ c
, rotateHue 30.0 c
, rotateHue 180.0 c
, rotateHue 210.0 c
]