Skip to content

nimterm/style

This page is generated from the module’s exported API and ## documentation comments.

Semantic terminal styles. Backends decide how styles are serialized.

ColorKind = enum
colorDefault, colorAnsi16, colorAnsi256, colorRgb

View source

ColorValue = object
kind*: ColorKind
value*: int
r*: int
g*: int
b*: int

View source

TextAttribute = enum
attrBold, attrDim, attrItalic, attrUnderline, attrReverse, attrStrikethrough

View source

Style = object
foreground*: ColorValue
background*: ColorValue
attributes*: set[TextAttribute]

View source

proc defaultColor(): ColorValue {.raises: [], tags: [], forbids: [].}

Returns: ColorValue.

View source

proc ansi16(index: int): ColorValue {.raises: [], tags: [], forbids: [].}

Returns: ColorValue.

Name Type Default
index int

View source

proc ansi256(index: int): ColorValue {.raises: [], tags: [], forbids: [].}

Returns: ColorValue.

Name Type Default
index int

View source

proc rgb(r, g, b: int): ColorValue {.raises: [], tags: [], forbids: [].}

Returns: ColorValue.

Name Type Default
r int
g int
b int

View source

proc defaultStyle(): Style {.raises: [], tags: [], forbids: [].}

Returns: Style.

View source

proc withForeground(style: Style; color: ColorValue): Style {.raises: [],
tags: [], forbids: [].}

Returns: Style.

Name Type Default
style Style
color ColorValue

View source

proc withBackground(style: Style; color: ColorValue): Style {.raises: [],
tags: [], forbids: [].}

Returns: Style.

Name Type Default
style Style
color ColorValue

View source

proc withAttribute(style: Style; attribute: TextAttribute): Style {.raises: [],
tags: [], forbids: [].}

Returns: Style.

Name Type Default
style Style
attribute TextAttribute

View source