5 colouriseKwd, colouriseBound, colouriseImplicit,
6 colouriseType, colouriseFun, colouriseData,
10import System.Console.ANSI
12data IdrisColour = IdrisColour { colour :: Maybe Color
20mkColour :: Color -> IdrisColour
21mkColour c = IdrisColour (Just c) True False False False
23data ColourTheme = ColourTheme { keywordColour :: IdrisColour
24 , boundVarColour :: IdrisColour
25 , implicitColour :: IdrisColour
26 , functionColour :: IdrisColour
27 , typeColour :: IdrisColour
28 , dataColour :: IdrisColour
29 , promptColour :: IdrisColour
33defaultTheme :: ColourTheme
34defaultTheme = ColourTheme { keywordColour = IdrisColour Nothing True True True False
35 , boundVarColour = mkColour Magenta
36 , implicitColour = IdrisColour (Just Magenta) True True False False
37 , functionColour = mkColour Green
38 , typeColour = mkColour Blue
39 , dataColour = mkColour Red
40 , promptColour = IdrisColour Nothing True False True False
43-- Set the colour of a string using POSIX escape codes
44colourise :: IdrisColour -> String -> String
45colourise (IdrisColour c v u b i) str = setSGRCode sgr ++ str ++ setSGRCode [Reset]
47 (if u then [SetUnderlining SingleUnderline] else []) ++
48 (if b then [SetConsoleIntensity BoldIntensity] else []) ++
49 (if i then [SetItalicized True] else [])
51 fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
53colouriseKwd :: ColourTheme -> String -> String
54colouriseKwd t = colourise (keywordColour t)
56colouriseBound :: ColourTheme -> String -> String
57colouriseBound t = colourise (boundVarColour t)
59colouriseImplicit :: ColourTheme -> String -> String
60colouriseImplicit t = colourise (implicitColour t)
62colouriseFun :: ColourTheme -> String -> String
63colouriseFun t = colourise (functionColour t)
65colouriseType :: ColourTheme -> String -> String
66colouriseType t = colourise (typeColour t)
68colouriseData :: ColourTheme -> String -> String
69colouriseData t = colourise (dataColour t)
71colourisePrompt :: ColourTheme -> String -> String
72colourisePrompt t = colourise (promptColour t)
75data ColourType = KeywordColour
82 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