Skip to content

Commit

Permalink
Merge pull request #4079 from commercialhaskell/ansi-backgrounds
Browse files Browse the repository at this point in the history
Prettyprinting colors should also have a background that contrasts #4047
  • Loading branch information
mgsloan authored Jun 14, 2018
2 parents 2dfafed + 0f303fe commit faa941a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Stack/PrettyPrint.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,53 +158,53 @@ debugBracket msg f = do
-- entire long messages. For example, it's used to style the "Error:"
-- label for an error message, not the entire message.
styleError :: AnsiDoc -> AnsiDoc
styleError = dullred
styleError = dullred . ondullblack

-- | Style an 'AnsiDoc' as a warning. Should be used sparingly, not to style
-- entire long messages. For example, it's used to style the "Warning:"
-- label for an error message, not the entire message.
styleWarning :: AnsiDoc -> AnsiDoc
styleWarning = yellow
styleWarning = yellow . ondullblack

-- | Style an 'AnsiDoc' in a way to emphasize that it is a particularly good
-- thing.
styleGood :: AnsiDoc -> AnsiDoc
styleGood = green
styleGood = green . ondullblack

-- | Style an 'AnsiDoc' as a shell command, i.e. when suggesting something
-- to the user that should be typed in directly as written.
styleShell :: AnsiDoc -> AnsiDoc
styleShell = magenta
styleShell = magenta . ondullblack

-- | Style an 'AnsiDoc' as a filename. See 'styleDir' for directories.
styleFile :: AnsiDoc -> AnsiDoc
styleFile = bold . white
styleFile = bold . white . ondullblack

-- | Style an 'AsciDoc' as a URL. For now using the same style as files.
styleUrl :: AnsiDoc -> AnsiDoc
styleUrl = styleFile

-- | Style an 'AnsiDoc' as a directory name. See 'styleFile' for files.
styleDir :: AnsiDoc -> AnsiDoc
styleDir = bold . blue
styleDir = bold . blue . ondullblack

-- | Style used to highlight part of a recommended course of action.
styleRecommendation :: AnsiDoc -> AnsiDoc
styleRecommendation = bold . green
styleRecommendation = bold . green . ondullblack

-- | Style an 'AnsiDoc' in a way that emphasizes that it is related to
-- a current thing. For example, could be used when talking about the
-- current package we're processing when outputting the name of it.
styleCurrent :: AnsiDoc -> AnsiDoc
styleCurrent = yellow
styleCurrent = yellow . ondullblack

-- TODO: figure out how to describe this
styleTarget :: AnsiDoc -> AnsiDoc
styleTarget = cyan
styleTarget = cyan . ondullblack

-- | Style an 'AnsiDoc' as a module name
styleModule :: AnsiDoc -> AnsiDoc
styleModule = magenta -- TODO: what color should this be?
styleModule = magenta . ondullblack -- TODO: what color should this be?

instance Display PackageName where
display = fromString . packageNameString
Expand Down

0 comments on commit faa941a

Please sign in to comment.