flix

0.80.0

RichString

Type of rich strings composed of styled text spans, and its functions.

enum RichStringSource
case RichString(Chain[Span])

Type of rich strings composed of styled text spans.

Instances

Add, Eq, Formattable, Monoid, SemiGroup, ToString

Enums

ColorType of text colors, either RGB colors or the terminal's default color.
SpanType of text spans with content, foreground color, background color, and styles.
StyleType of text styling options.

Definitions

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

def bold(x: a): RichString \ Formattable.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 \ Formattable.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 equals(rs1: RichString, rs2: RichString): Bool§ Source

Returns a Bool according to the equality of rs1 and rs2.

Checks whether text and styling is equivalent for each individual character.

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 \ Formattable.Aef[a] with Formattable[a]§ Source

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

def green(x: a): RichString \ Formattable.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 \ Formattable.Aef[a] + Foldable.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 + Foldable.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 \ Formattable.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 \ Formattable.Aef[a] with Formattable[a]§ Source

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

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

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

def toPlainString(rs: RichString): String§ Source

Returns the plain text representation of the RichString rs.

All styling and color information is discarded.

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 \ Formattable.Aef[a] with Formattable[a]§ Source

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

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

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

def withBgColor(c: Color, x: a): RichString \ Formattable.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 \ Formattable.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 \ Formattable.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 \ Formattable.Aef[a] with Formattable[a]§ Source

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