src/repl/styledoutput

Source   Edit  

Types

ColorScheme = object
  fg*: Option[(ForegroundColor, bool)]
  bg*: Option[(BackgroundColor, bool)]
Source   Edit  
Output = object
  nim*: ColorScheme
  promptMessage*: ColorScheme
  promptSymbol*: ColorScheme
  okResult*: ColorScheme
  info*: ColorScheme
  warning*: ColorScheme
  error*: ColorScheme
Source   Edit  

Procs

proc colorScheme(fgColor: ForegroundColor = fgDefault; fgBright: bool = false;
                 bgColor: BackgroundColor = bgDefault; bgBright: bool = false): ColorScheme {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc error(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the error color scheme. Source   Edit  
proc info(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the info color scheme. Source   Edit  
proc newOutput(colors: bool = true;
               nim: ColorScheme = colorScheme(fgYellow, true);
               promptMessage: ColorScheme = colorScheme(fgYellow, false);
               promptSymbol: ColorScheme = colorScheme();
               okResult: ColorScheme = colorScheme(fgCyan, false);
               info: ColorScheme = colorScheme();
               warning: ColorScheme = colorScheme(fgYellow, false);
               error: ColorScheme = colorScheme(fgRed, false)): Output {.
    ...raises: [], tags: [], forbids: [].}
Creates a new Output object with the given color schemes. The object output schemes are
  • prompt message and symbol: the console's prompt colors.
  • ok result: colors for a succesful result.
  • info: colors for information messages.
  • warning: colors for warning messages.
  • error: colors for error messages.
  • nim: colors used just to stylize nim mentions.
Source   Edit  
proc nim(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the nim color scheme. Source   Edit  
proc okResult(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the ok result color scheme. Source   Edit  
proc promptMessage(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the prompt message color scheme. Source   Edit  
proc promptSymbol(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the prompt symbol color scheme. Source   Edit  
proc styledPrompt(self: Output; message: string; symbol: string): Styler {.
    ...raises: [], tags: [], forbids: [].}
Creates a styled prompt with the given message and symbol. Source   Edit  
proc unstyled(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message without any color scheme. Source   Edit  
proc warning(self: Output; message: string) {....raises: [IOError],
    tags: [WriteIOEffect], forbids: [].}
Writes a message with the warning color scheme. Source   Edit  
proc write(self: Output; message: string; color: ColorScheme = colorScheme()) {.
    ...raises: [IOError], tags: [WriteIOEffect], forbids: [].}
Writes a message with the given color scheme. Source   Edit