flix

0.67.0

RichString

enum RichStringSource
case RichString(Chain[Span])

A rich string composed of multiple styled spans.

Instances

instance Add[RichString]Source
instance Formattable[RichString]Source
instance Monoid[RichString]Source
instance SemiGroup[RichString]Source
instance ToString[RichString]Source

Definitions

def bgBlack(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on black background.

def bgBlue(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on blue background.

def bgCyan(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on cyan background.

def bgGreen(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on green background.

def bgMagenta(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on magenta background.

def bgRed(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on red background.

def bgWhite(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on white background.

def bgYellow(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x on yellow background.

def black(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in black color.

def blue(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in blue color.

def bold(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in bold style.

def combine(rs1: RichString, rs2: RichString): RichString Source

Returns the concatenation of rs1 and rs2.

The spans from rs1 appear first, followed by the spans from rs2.

def cyan(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in cyan color.

def empty(): RichString Source

Returns an empty RichString.

def fromSpan(s: Span): RichString Source

Returns a RichString containing the given span s.

def fromString(s: String): RichString Source

Returns a RichString from the given string s using default colors and no styles.

def gray(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in gray color.

def green(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in green color.

def join(sep: RichString, xs: t[a]): RichString \ Aef[a] + Aef[t] with Formattable[a], Foldable[t] Source

Returns the concatenation of the elements in xs formatted with RichString sep inserted between each.

Uses the Formattable trait to format each element.

def joinWith(f: a -> RichString \ ef, sep: RichString, xs: t[a]): RichString \ ef + Aef[t] with Foldable[t] Source

Returns the concatenation of elements in xs according to f with RichString sep inserted between each.

def magenta(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in magenta color.

def map(f: Span -> Span, rs: RichString): RichString Source

Returns a RichString with the function f applied to every span.

def red(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in red color.

def text(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x using default colors and normal style.

def toString(rs: RichString): String Source

Returns a string representation of the given rs.

If the terminal supports ANSI colors, returns the string with ANSI escape codes. Otherwise, returns the plain text representation without styling.

def underline(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in underline style.

def white(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in white color.

def withBgColor(c: Color, x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString from given text x with all spans updated to use the given background color c.

def withColor(c: Color, x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString from given text x with all spans updated to use the given foreground color c.

def withStyle(style: Style, x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString from given text x with the given style in addition to any other styles it already has.

def yellow(x: a): RichString \ Aef[a] with Formattable[a] Source

Returns a RichString with the given text x in yellow color.