snippet-0.1.0.3: src/Snippet/Pretty/Ann.hs
module Snippet.Pretty.Ann
( Ann (..)
, annToAnsi
) where
import Prelude
import Prettyprinter.Render.Terminal (AnsiStyle, Color (..), bold, colorDull)
data Ann
= -- | Line numbers, left-hand bar, etc
AnnDecoration
| -- | Focused line content by depth (0 is un-focused)
AnnFocused Int
| -- | Message annotating the region
AnnMessage
deriving stock (Eq, Show)
annToAnsi :: Ann -> AnsiStyle
annToAnsi = \case
AnnDecoration -> colorDull Blue
AnnFocused 0 -> mempty
AnnFocused n ->
colorDull
$ (!! (n - 1))
$ cycle [Green, Red, Cyan, Yellow, Magenta, Blue]
AnnMessage -> bold