@@ -122,7 +122,8 @@ data IState = IState {
122 idris_dynamic_libs :: [DynamicLib],
122 idris_dynamic_libs :: [DynamicLib],
123 idris_language_extensions :: [LanguageExt],
123 idris_language_extensions :: [LanguageExt],
124 idris_outputmode :: OutputMode,
124 idris_outputmode :: OutputMode,
125− idris_colourRepl :: Bool
125+ idris_colourRepl :: Bool,
126+ idris_colourTheme :: ColourTheme
128data SizeChange = Smaller | Same | Bigger | Unknown
129data SizeChange = Smaller | Same | Bigger | Unknown
@@ -180,7 +181,7 @@ idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
180 emptyContext emptyContext emptyContext emptyContext
181 emptyContext emptyContext emptyContext emptyContext
181 [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] []
182 [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] []
182 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
183 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
183− True
184+ True defaultTheme
185-- | The monad for the main REPL - reading and processing files and updating
186-- | The monad for the main REPL - reading and processing files and updating
186-- global state (hence the IO inner monad).
187-- global state (hence the IO inner monad).
@@ -1050,41 +1051,45 @@ prettyImp impl = prettySe 10
1050 | otherwise = doc
1051 | otherwise = doc
1052-- | Show Idris name
1053-- | Show Idris name
1053−showName :: Maybe IState -- ^^ the Idris state, for information about names
1054+showName :: Maybe IState -- ^^ the Idris state, for information about names and colours
1054 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1055 -> [(Name, Bool)] -- ^^ the bound variables and whether they're implicit
1055 -> Bool -- ^^ whether to show implicits
1056 -> Bool -- ^^ whether to show implicits
1056 -> Bool -- ^^ whether to colourise
1057 -> Bool -- ^^ whether to colourise
1057 -> Name -- ^^ the term to show
1058 -> Name -- ^^ the term to show
1058 -> String
1059 -> String
1060+showName ist bnd impl colour n = case ist of
1059−showName ist bnd impl colour n = if colour then colourise n else showbasic n
1061+ Just i -> if colour then colourise n (idris_colourTheme i) else showbasic n
1062+ Nothing -> showbasic n
1060 where name = if impl then show n else showbasic n
1063 where name = if impl then show n else showbasic n
1061 showbasic n@(UN _) = show n
1064 showbasic n@(UN _) = show n
1062 showbasic (MN _ s) = s
1065 showbasic (MN _ s) = s
1063 showbasic (NS n s) = showSep "." (reverse s) ++ "." ++ showbasic n
1066 showbasic (NS n s) = showSep "." (reverse s) ++ "." ++ showbasic n
1064 showbasic (SN s) = show s
1067 showbasic (SN s) = show s
1065 fst3 (x, _, _) = x
1068 fst3 (x, _, _) = x
1066− colourise n = let ctxt' = fmap tt_ctxt ist in
1069+ colourise n t = let ctxt' = fmap tt_ctxt ist in
1067− case ctxt' of
1070+ case ctxt' of
1068− Nothing -> name
1071+ Nothing -> name
1069− Just ctxt | Just impl <- lookup n bnd -> if impl then colouriseImplicit name
1072+ Just ctxt | Just impl <- lookup n bnd -> if impl then colouriseImplicit t name
1070− else colouriseBound name
1073+ else colouriseBound t name
1071− | isDConName n ctxt -> colouriseData name
1074+ | isDConName n ctxt -> colouriseData t name
1072− | isFnName n ctxt -> colouriseFun name
1075+ | isFnName n ctxt -> colouriseFun t name
1073− | isTConName n ctxt -> colouriseType name
1076+ | isTConName n ctxt -> colouriseType t name
1074− -- The assumption is that if a name is not bound and does not exist in the
1077+ -- The assumption is that if a name is not bound and does not exist in the
1075− -- global context, then we're somewhere in which implicit info has been lost
1078+ -- global context, then we're somewhere in which implicit info has been lost
1076− -- (like error messages). Thus, unknown vars are colourised as implicits.
1079+ -- (like error messages). Thus, unknown vars are colourised as implicits.
1077− | otherwise -> colouriseImplicit name
1080+ | otherwise -> colouriseImplicit t name
1079-- | Show Idris term
1082-- | Show Idris term
1080−showImp :: Maybe IState -- ^^ the Idris state, for information about identifiers
1083+showImp :: Maybe IState -- ^^ the Idris state, for information about identifiers and colours
1081 -> Bool -- ^^ whether to show implicits
1084 -> Bool -- ^^ whether to show implicits
1082 -> Bool -- ^^ whether to colourise
1085 -> Bool -- ^^ whether to colourise
1083 -> PTerm -- ^^ the term to show
1086 -> PTerm -- ^^ the term to show
1084 -> String
1087 -> String
1085showImp ist impl colour tm = se 10 [] tm where
1088showImp ist impl colour tm = se 10 [] tm where
1086− perhapsColourise :: (String -> String) -> String -> String
1089+ perhapsColourise :: (ColourTheme -> String -> String) -> String -> String
1087− perhapsColourise col str = if colour then col str else str
1090+ perhapsColourise col str = case ist of
1091+ Just i -> if colour then col (idris_colourTheme i) str else str
1089 se :: Int -> [(Name, Bool)] -> PTerm -> String
1094 se :: Int -> [(Name, Bool)] -> PTerm -> String
1090 se p bnd (PQuote r) = "![" ++ show r ++ "]"
1095 se p bnd (PQuote r) = "![" ++ show r ++ "]"