5 colouriseKwd, colouriseBound, colouriseImplicit, colourisePostulate,
6 colouriseType, colouriseFun, colouriseData, colouriseKeyword,
7 colourisePrompt, colourise, ColourType(..)) where
9import System.Console.ANSI
11data IdrisColour = IdrisColour { colour :: Maybe Color
19mkColour :: Color -> IdrisColour
20mkColour c = IdrisColour (Just c) True False 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
29 , postulateColour :: IdrisColour
33-- | Idris's default console colour theme
34defaultTheme :: ColourTheme
35defaultTheme = ColourTheme { keywordColour = IdrisColour Nothing True False True False
36 , boundVarColour = mkColour Magenta
37 , implicitColour = IdrisColour (Just Magenta) True True False False
38 , functionColour = mkColour Green
39 , typeColour = mkColour Blue
40 , dataColour = mkColour Red
41 , promptColour = IdrisColour Nothing True False True False
42 , postulateColour = IdrisColour (Just Green) True False True False
45-- | Set the colour of a string using POSIX escape codes
46colourise :: IdrisColour -> String -> String
47colourise (IdrisColour c v u b i) str = setSGRCode sgr ++ str ++ setSGRCode [Reset]
49 (if u then [SetUnderlining SingleUnderline] else []) ++
50 (if b then [SetConsoleIntensity BoldIntensity] else []) ++
51 (if i then [SetItalicized True] else [])
53 fg (Just c) = [SetColor Foreground (if v then Vivid else Dull) c]
55colouriseKwd :: ColourTheme -> String -> String
56colouriseKwd t = colourise (keywordColour t)
58colouriseBound :: ColourTheme -> String -> String
59colouriseBound t = colourise (boundVarColour t)
61colouriseImplicit :: ColourTheme -> String -> String
62colouriseImplicit t = colourise (implicitColour t)
64colouriseFun :: ColourTheme -> String -> String
65colouriseFun t = colourise (functionColour t)
67colouriseType :: ColourTheme -> String -> String
68colouriseType t = colourise (typeColour t)
70colouriseData :: ColourTheme -> String -> String
71colouriseData t = colourise (dataColour t)
73colourisePrompt :: ColourTheme -> String -> String
74colourisePrompt t = colourise (promptColour t)
76colouriseKeyword :: ColourTheme -> String -> String
77colouriseKeyword t = colourise (keywordColour t)
79colourisePostulate :: ColourTheme -> String -> String
80colourisePostulate t = colourise (postulateColour t)
83data ColourType = KeywordColour
91 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