style

This module handles all the work associated with different styles and parsing them from the LS_COLORS string

Types

Color8 = enum
  c8Black, c8Red, c8Green, c8Yellow, c8Blue, c8Magenta, c8Cyan, c8White
A selection of the 8 terminal colors
ColorFixed = uint8
One color of the 256 terminal colors
ColorRGB = tuple[r: uint8, g: uint8, b: uint8]
RBG colors
ColorKind = enum
  ck8, ckFixed, ckRGB
Three possible color descriptions
Color = object
  case kind*: ColorKind
  of ck8:
      ck8Val*: Color8

  of ckFixed:
      ckFixedVal*: ColorFixed

  of ckRGB:
      ckRGBVal*: ColorRGB

  
Represents a color of terminal text
FontStyle = object
  bold*: bool
  italic*: bool
  underline*: bool
Represents a font style
Style = object
  fg*: Option[Color]
  bg*: Option[Color]
  font*: FontStyle
Represents a terminal output style

Procs

proc defaultFontStyle(): FontStyle {...}{.raises: [], tags: [].}
Default font (not bold, not italic, not underlined)
proc defaultStyle(): Style {...}{.raises: [], tags: [].}
Default style (no colors, default font)
proc parseStyle(str: string): Option[Style] {...}{.raises: [], tags: [].}
Parses the style description