🌈 TuiCrown 👑
https://github.com/pysan3/tuicrown
Tuicrown is a Nim library for rich text and beautiful formatting in the terminal.
This library also provides top level aliases such as print, input for ease of use.
input
The following code-block is not accurate due to reStructuredText constraints.
var prog = input("[yellow]Nim :crown:[yellow] or [blue]Python :snake:[/]?")
Example:
import tuicrown print("[green]Hello Nim![/]") print(true, false, 100, 0.001, 1e-6) print("[yellow]Nim :crown:[yellow] or [blue]Python :snake:[/]?")
Examples and Tests
Example usages are listed in https://github.com/pysan3/tuicrown/tree/main/tests . If you have more interests on the syntax, take a look there.
Lets
gConsoleErr = newTuiConsole(newTuiConsoleOptions(true, 2, false, false, true, true, false, false, false), "auto", stderr, -1, -1)
- Global console object writing to stderr. Source Edit
gConsoleOut = newTuiConsole(newTuiConsoleOptions(true, 2, false, false, true, true, false, false, false), "auto", stdout, -1, -1)
- Global console object used for print. Source Edit
Procs
proc input(args: varargs[string, `$`]): string {. ...raises: [KeyError, Exception, ValueError, OSError, IOError], tags: [ RootEffect, ReadEnvEffect, WriteEnvEffect, WriteIOEffect, ReadIOEffect], forbids: [].}
-
Asks for user input from stdin with prompt colored with TuiCrown.
var prog = input("[yellow]Nim :crown:[yellow] or [blue]Python :snake:[/]?")
Source Edit proc print(args: varargs[string, `$`]) {. ...raises: [KeyError, Exception, ValueError, OSError, IOError], tags: [RootEffect, ReadEnvEffect, WriteEnvEffect, WriteIOEffect], forbids: [].}
-
print to stdout with style parsing. Values will be space separated.
Example:
print("[green]Hello Nim![/]") print(true, false, 100, 0.001, 1e-6)
Source Edit