summaryrefslogtreecommitdiffstats
path: root/app/Pretty/Color.hs
blob: 7a55909477945ca149a9ec648a6470a19ce0f976 (plain)
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
55
56
57
58
59
60
{-# OPTIONS_GHC -fno-warn-unused-top-binds #-}

module Pretty.Color
  ( Color (..),
    Intensity (..),
    toXColor,
    XColor (..),
  )
where

data Color
  = Black
  | Red
  | Green
  | Yellow
  | Blue
  | Magenta
  | Cyan
  | White
  deriving (Show, Eq, Ord)

toXColor :: (Intensity, Color) -> XColor
toXColor (Dull, Black) = Color0
toXColor (Dull, Red) = Color1
toXColor (Dull, Green) = Color2
toXColor (Dull, Yellow) = Color3
toXColor (Dull, Blue) = Color4
toXColor (Dull, Magenta) = Color5
toXColor (Dull, Cyan) = Color6
toXColor (Dull, White) = Color7
toXColor (Vivid, Black) = Color8
toXColor (Vivid, Red) = Color9
toXColor (Vivid, Green) = Color10
toXColor (Vivid, Yellow) = Color11
toXColor (Vivid, Blue) = Color12
toXColor (Vivid, Magenta) = Color13
toXColor (Vivid, Cyan) = Color14
toXColor (Vivid, White) = Color15

data Intensity = Vivid | Dull
  deriving (Show, Eq, Ord)

data XColor
  = Color0
  | Color1
  | Color2
  | Color3
  | Color4
  | Color5
  | Color6
  | Color7
  | Color8
  | Color9
  | Color10
  | Color11
  | Color12
  | Color13
  | Color14
  | Color15
  deriving (Eq, Ord, Enum)