Currently, it's possible to keep some colors and override others (e.g. keep foreground color, but change background color), but it's impossible to revert to terminal default for one or the other. This is particularly inconvenient when trying to use a »default« color like black or white in a color scheme that is required to work for both dark and light backgrounds.
This behavior is encoded in the type AnsiStyle:
data AnsiStyle = SetAnsiStyle
{ ansiForeground :: Maybe (Intensity, Color) -- ^ Set the foreground color, or keep the old one.
, ansiBackground :: Maybe (Intensity, Color) -- ^ Set the background color, or keep the old one.
, ansiBold :: Maybe Bold -- ^ Switch on boldness, or don’t do anything.
, ansiItalics :: Maybe Italicized -- ^ Switch on italics, or don’t do anything.
, ansiUnderlining :: Maybe Underlined -- ^ Switch on underlining, or don’t do anything.
} deriving (Eq, Ord, Show)
Instead of Maybe a, this should be a ternary Keep | Default | SetTo a just like vty's Attr does it with its MaybeDefault type.
Currently, it's possible to keep some colors and override others (e.g. keep foreground color, but change background color), but it's impossible to revert to terminal default for one or the other. This is particularly inconvenient when trying to use a »default« color like black or white in a color scheme that is required to work for both dark and light backgrounds.
This behavior is encoded in the type
AnsiStyle:Instead of
Maybe a, this should be a ternaryKeep | Default | SetTo ajust likevty'sAttrdoes it with itsMaybeDefaulttype.