5 colouriseKwd, colouriseBound, colouriseImplicit,
6 colouriseType, colouriseFun, colouriseData,
10import System.Console.ANSI
12data IdrisColour = IdrisColour { colour :: Color
19mkColour :: Color -> IdrisColour
20mkColour c = IdrisColour c True False False
22data ColourTheme = ColourTheme { keywordColour :: IdrisColour
23 , boundVarColour :: IdrisColour
24 , implicitColour :: IdrisColour
25 , functionColour :: IdrisColour
26 , typeColour :: IdrisColour
27 , dataColour :: IdrisColour
28 , promptColour :: IdrisColour
32defaultTheme :: ColourTheme
33defaultTheme = ColourTheme { keywordColour = IdrisColour Black True True True
34 , boundVarColour = mkColour Magenta
35 , implicitColour = IdrisColour Magenta True True False
36 , functionColour = mkColour Green
37 , typeColour = mkColour Blue
38 , dataColour = mkColour Red
39 , promptColour = IdrisColour Black True False True
42-- Set the colour of a string using POSIX escape codes
43colourise :: IdrisColour -> String -> String
44colourise (IdrisColour c v u b) str = setSGRCode sgr ++ str ++ setSGRCode [Reset]
45 where sgr = [SetColor Foreground (if v then Vivid else Dull) c] ++
46 (if u then [SetUnderlining SingleUnderline] else []) ++
47 (if b then [SetConsoleIntensity BoldIntensity] else [])
49colouriseKwd :: ColourTheme -> String -> String
50colouriseKwd t = colourise (keywordColour t)
52colouriseBound :: ColourTheme -> String -> String
53colouriseBound t = colourise (boundVarColour t)
55colouriseImplicit :: ColourTheme -> String -> String
56colouriseImplicit t = colourise (implicitColour t)
58colouriseFun :: ColourTheme -> String -> String
59colouriseFun t = colourise (functionColour t)
61colouriseType :: ColourTheme -> String -> String
62colouriseType t = colourise (typeColour t)
64colouriseData :: ColourTheme -> String -> String
65colouriseData t = colourise (dataColour t)
67colourisePrompt :: ColourTheme -> String -> String
68colourisePrompt t = colourise (promptColour t)
71data ColourType = KeywordColour
78 deriving (Eq, Show, Bounded, Enum)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list