terminal.html 113 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>std/terminal</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  14. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">std/terminal</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li><a class="reference" id="progress-bar_toc" href="#progress-bar">Progress bar</a></li>
  50. <ul class="simple"><li><a class="reference" id="progress-bar-playing-with-colorful-and-styled-text_toc" href="#progress-bar-playing-with-colorful-and-styled-text">Playing with colorful and styled text</a></li>
  51. </ul><li>
  52. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  53. </li>
  54. <li>
  55. <details open>
  56. <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
  57. <ul class="simple simple-toc-section">
  58. <li><a class="reference" href="#BackgroundColor" title="BackgroundColor = enum
  59. bgBlack = 40, ## black
  60. bgRed, ## red
  61. bgGreen, ## green
  62. bgYellow, ## yellow
  63. bgBlue, ## blue
  64. bgMagenta, ## magenta
  65. bgCyan, ## cyan
  66. bgWhite, ## white
  67. bg8Bit, ## 256-color (not supported, see `enableTrueColors` instead.)
  68. bgDefault ## default terminal background color">BackgroundColor</a></li>
  69. <li><a class="reference" href="#ForegroundColor" title="ForegroundColor = enum
  70. fgBlack = 30, ## black
  71. fgRed, ## red
  72. fgGreen, ## green
  73. fgYellow, ## yellow
  74. fgBlue, ## blue
  75. fgMagenta, ## magenta
  76. fgCyan, ## cyan
  77. fgWhite, ## white
  78. fg8Bit, ## 256-color (not supported, see `enableTrueColors` instead.)
  79. fgDefault ## default terminal foreground color">ForegroundColor</a></li>
  80. <li><a class="reference" href="#Style" title="Style = enum
  81. styleBright = 1, ## bright text
  82. styleDim, ## dim text
  83. styleItalic, ## italic (or reverse on terminals not supporting)
  84. styleUnderscore, ## underscored text
  85. styleBlink, ## blinking/bold text
  86. styleBlinkRapid, ## rapid blinking/bold text (not widely supported)
  87. styleReverse, ## reverse
  88. styleHidden, ## hidden text
  89. styleStrikethrough ## strikethrough">Style</a></li>
  90. <li><a class="reference" href="#TerminalCmd" title="TerminalCmd = enum
  91. resetStyle, ## reset attributes
  92. fgColor, ## set foreground's true color
  93. bgColor ## set background's true color">TerminalCmd</a></li>
  94. </ul>
  95. </details>
  96. </li>
  97. <li>
  98. <details open>
  99. <summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
  100. <ul class="simple simple-toc-section">
  101. <li><a class="reference" href="#ansiResetCode" title="ansiResetCode = &quot;\e[0m&quot;">ansiResetCode</a></li>
  102. </ul>
  103. </details>
  104. </li>
  105. <li>
  106. <details open>
  107. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  108. <ul class="simple simple-toc-section">
  109. <ul class="simple nested-toc-section">ansiBackgroundColorCode
  110. <li><a class="reference" href="#ansiBackgroundColorCode%2CColor" title="ansiBackgroundColorCode(color: Color): string">ansiBackgroundColorCode(color: Color): string</a></li>
  111. </ul>
  112. <ul class="simple nested-toc-section">ansiForegroundColorCode
  113. <li><a class="reference" href="#ansiForegroundColorCode%2CColor" title="ansiForegroundColorCode(color: Color): string">ansiForegroundColorCode(color: Color): string</a></li>
  114. <li><a class="reference" href="#ansiForegroundColorCode%2CForegroundColor" title="ansiForegroundColorCode(fg: ForegroundColor; bright = false): string">ansiForegroundColorCode(fg: ForegroundColor; bright = false): string</a></li>
  115. </ul>
  116. <ul class="simple nested-toc-section">ansiStyleCode
  117. <li><a class="reference" href="#ansiStyleCode%2Cint" title="ansiStyleCode(style: int): string">ansiStyleCode(style: int): string</a></li>
  118. </ul>
  119. <ul class="simple nested-toc-section">cursorBackward
  120. <li><a class="reference" href="#cursorBackward%2CFile%2Cint" title="cursorBackward(f: File; count = 1)">cursorBackward(f: File; count = 1)</a></li>
  121. </ul>
  122. <ul class="simple nested-toc-section">cursorDown
  123. <li><a class="reference" href="#cursorDown%2CFile%2Cint" title="cursorDown(f: File; count = 1)">cursorDown(f: File; count = 1)</a></li>
  124. </ul>
  125. <ul class="simple nested-toc-section">cursorForward
  126. <li><a class="reference" href="#cursorForward%2CFile%2Cint" title="cursorForward(f: File; count = 1)">cursorForward(f: File; count = 1)</a></li>
  127. </ul>
  128. <ul class="simple nested-toc-section">cursorUp
  129. <li><a class="reference" href="#cursorUp%2CFile%2Cint" title="cursorUp(f: File; count = 1)">cursorUp(f: File; count = 1)</a></li>
  130. </ul>
  131. <ul class="simple nested-toc-section">disableTrueColors
  132. <li><a class="reference" href="#disableTrueColors" title="disableTrueColors()">disableTrueColors()</a></li>
  133. </ul>
  134. <ul class="simple nested-toc-section">enableTrueColors
  135. <li><a class="reference" href="#enableTrueColors" title="enableTrueColors()">enableTrueColors()</a></li>
  136. </ul>
  137. <ul class="simple nested-toc-section">eraseLine
  138. <li><a class="reference" href="#eraseLine%2CFile" title="eraseLine(f: File)">eraseLine(f: File)</a></li>
  139. </ul>
  140. <ul class="simple nested-toc-section">eraseScreen
  141. <li><a class="reference" href="#eraseScreen%2CFile" title="eraseScreen(f: File)">eraseScreen(f: File)</a></li>
  142. </ul>
  143. <ul class="simple nested-toc-section">getch
  144. <li><a class="reference" href="#getch" title="getch(): char">getch(): char</a></li>
  145. </ul>
  146. <ul class="simple nested-toc-section">getCursorPos
  147. <li><a class="reference" href="#getCursorPos" title="getCursorPos(): tuple[x, y: int]">getCursorPos(): tuple[x, y: int]</a></li>
  148. </ul>
  149. <ul class="simple nested-toc-section">hideCursor
  150. <li><a class="reference" href="#hideCursor%2CFile" title="hideCursor(f: File)">hideCursor(f: File)</a></li>
  151. </ul>
  152. <ul class="simple nested-toc-section">isatty
  153. <li><a class="reference" href="#isatty%2CFile" title="isatty(f: File): bool">isatty(f: File): bool</a></li>
  154. </ul>
  155. <ul class="simple nested-toc-section">isTrueColorSupported
  156. <li><a class="reference" href="#isTrueColorSupported" title="isTrueColorSupported(): bool">isTrueColorSupported(): bool</a></li>
  157. </ul>
  158. <ul class="simple nested-toc-section">readPasswordFromStdin
  159. <li><a class="reference" href="#readPasswordFromStdin%2Cstring" title="readPasswordFromStdin(prompt = &quot;password: &quot;): string">readPasswordFromStdin(prompt = &quot;password: &quot;): string</a></li>
  160. <li><a class="reference" href="#readPasswordFromStdin%2Cstring%2Cstring" title="readPasswordFromStdin(prompt: string; password: var string): bool">readPasswordFromStdin(prompt: string; password: var string): bool</a></li>
  161. </ul>
  162. <ul class="simple nested-toc-section">resetAttributes
  163. <li><a class="reference" href="#resetAttributes" title="resetAttributes()">resetAttributes()</a></li>
  164. <li><a class="reference" href="#resetAttributes%2CFile" title="resetAttributes(f: File)">resetAttributes(f: File)</a></li>
  165. </ul>
  166. <ul class="simple nested-toc-section">setBackgroundColor
  167. <li><a class="reference" href="#setBackgroundColor%2CFile%2CBackgroundColor" title="setBackgroundColor(f: File; bg: BackgroundColor; bright = false)">setBackgroundColor(f: File; bg: BackgroundColor; bright = false)</a></li>
  168. <li><a class="reference" href="#setBackgroundColor%2CFile%2CColor" title="setBackgroundColor(f: File; color: Color)">setBackgroundColor(f: File; color: Color)</a></li>
  169. </ul>
  170. <ul class="simple nested-toc-section">setCursorPos
  171. <li><a class="reference" href="#setCursorPos%2CFile%2Cint%2Cint" title="setCursorPos(f: File; x, y: int)">setCursorPos(f: File; x, y: int)</a></li>
  172. </ul>
  173. <ul class="simple nested-toc-section">setCursorXPos
  174. <li><a class="reference" href="#setCursorXPos%2CFile%2Cint" title="setCursorXPos(f: File; x: int)">setCursorXPos(f: File; x: int)</a></li>
  175. </ul>
  176. <ul class="simple nested-toc-section">setForegroundColor
  177. <li><a class="reference" href="#setForegroundColor%2CFile%2CColor" title="setForegroundColor(f: File; color: Color)">setForegroundColor(f: File; color: Color)</a></li>
  178. <li><a class="reference" href="#setForegroundColor%2CFile%2CForegroundColor" title="setForegroundColor(f: File; fg: ForegroundColor; bright = false)">setForegroundColor(f: File; fg: ForegroundColor; bright = false)</a></li>
  179. </ul>
  180. <ul class="simple nested-toc-section">setStyle
  181. <li><a class="reference" href="#setStyle%2CFile%2Cset%5BStyle%5D" title="setStyle(f: File; style: set[Style])">setStyle(f: File; style: set[Style])</a></li>
  182. </ul>
  183. <ul class="simple nested-toc-section">showCursor
  184. <li><a class="reference" href="#showCursor%2CFile" title="showCursor(f: File)">showCursor(f: File)</a></li>
  185. </ul>
  186. <ul class="simple nested-toc-section">terminalHeight
  187. <li><a class="reference" href="#terminalHeight" title="terminalHeight(): int">terminalHeight(): int</a></li>
  188. </ul>
  189. <ul class="simple nested-toc-section">terminalHeightIoctl
  190. <li><a class="reference" href="#terminalHeightIoctl%2CopenArray%5Bint%5D" title="terminalHeightIoctl(fds: openArray[int]): int">terminalHeightIoctl(fds: openArray[int]): int</a></li>
  191. </ul>
  192. <ul class="simple nested-toc-section">terminalSize
  193. <li><a class="reference" href="#terminalSize" title="terminalSize(): tuple[w, h: int]">terminalSize(): tuple[w, h: int]</a></li>
  194. </ul>
  195. <ul class="simple nested-toc-section">terminalWidth
  196. <li><a class="reference" href="#terminalWidth" title="terminalWidth(): int">terminalWidth(): int</a></li>
  197. </ul>
  198. <ul class="simple nested-toc-section">terminalWidthIoctl
  199. <li><a class="reference" href="#terminalWidthIoctl%2CopenArray%5Bint%5D" title="terminalWidthIoctl(fds: openArray[int]): int">terminalWidthIoctl(fds: openArray[int]): int</a></li>
  200. </ul>
  201. <ul class="simple nested-toc-section">writeStyled
  202. <li><a class="reference" href="#writeStyled%2Cstring%2Cset%5BStyle%5D" title="writeStyled(txt: string; style: set[Style] = {styleBright})">writeStyled(txt: string; style: set[Style] = {styleBright})</a></li>
  203. </ul>
  204. </ul>
  205. </details>
  206. </li>
  207. <li>
  208. <details open>
  209. <summary><a class="reference reference-toplevel" href="#17" id="67">Macros</a></summary>
  210. <ul class="simple simple-toc-section">
  211. <ul class="simple nested-toc-section">styledWrite
  212. <li><a class="reference" href="#styledWrite.m%2CFile%2Cvarargs%5Btyped%5D" title="styledWrite(f: File; m: varargs[typed]): untyped">styledWrite(f: File; m: varargs[typed]): untyped</a></li>
  213. </ul>
  214. </ul>
  215. </details>
  216. </li>
  217. <li>
  218. <details open>
  219. <summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
  220. <ul class="simple simple-toc-section">
  221. <ul class="simple nested-toc-section">ansiBackgroundColorCode
  222. <li><a class="reference" href="#ansiBackgroundColorCode.t%2Cstatic%5BColor%5D" title="ansiBackgroundColorCode(color: static[Color]): string">ansiBackgroundColorCode(color: static[Color]): string</a></li>
  223. </ul>
  224. <ul class="simple nested-toc-section">ansiForegroundColorCode
  225. <li><a class="reference" href="#ansiForegroundColorCode.t%2Cstatic%5BColor%5D" title="ansiForegroundColorCode(color: static[Color]): string">ansiForegroundColorCode(color: static[Color]): string</a></li>
  226. <li><a class="reference" href="#ansiForegroundColorCode.t%2Cstatic%5BForegroundColor%5D%2Cstatic%5Bbool%5D" title="ansiForegroundColorCode(fg: static[ForegroundColor];
  227. bright: static[bool] = false): string">ansiForegroundColorCode(fg: static[ForegroundColor];
  228. bright: static[bool] = false): string</a></li>
  229. </ul>
  230. <ul class="simple nested-toc-section">ansiStyleCode
  231. <li><a class="reference" href="#ansiStyleCode.t%2Cstatic%5BStyle%5D" title="ansiStyleCode(style: static[Style]): string">ansiStyleCode(style: static[Style]): string</a></li>
  232. <li><a class="reference" href="#ansiStyleCode.t%2CStyle" title="ansiStyleCode(style: Style): string">ansiStyleCode(style: Style): string</a></li>
  233. </ul>
  234. <ul class="simple nested-toc-section">cursorBackward
  235. <li><a class="reference" href="#cursorBackward.t%2Cint" title="cursorBackward(count = 1)">cursorBackward(count = 1)</a></li>
  236. </ul>
  237. <ul class="simple nested-toc-section">cursorDown
  238. <li><a class="reference" href="#cursorDown.t%2Cint" title="cursorDown(count = 1)">cursorDown(count = 1)</a></li>
  239. </ul>
  240. <ul class="simple nested-toc-section">cursorForward
  241. <li><a class="reference" href="#cursorForward.t%2Cint" title="cursorForward(count = 1)">cursorForward(count = 1)</a></li>
  242. </ul>
  243. <ul class="simple nested-toc-section">cursorUp
  244. <li><a class="reference" href="#cursorUp.t%2Cint" title="cursorUp(count = 1)">cursorUp(count = 1)</a></li>
  245. </ul>
  246. <ul class="simple nested-toc-section">eraseLine
  247. <li><a class="reference" href="#eraseLine.t" title="eraseLine()">eraseLine()</a></li>
  248. </ul>
  249. <ul class="simple nested-toc-section">eraseScreen
  250. <li><a class="reference" href="#eraseScreen.t" title="eraseScreen()">eraseScreen()</a></li>
  251. </ul>
  252. <ul class="simple nested-toc-section">hideCursor
  253. <li><a class="reference" href="#hideCursor.t" title="hideCursor()">hideCursor()</a></li>
  254. </ul>
  255. <ul class="simple nested-toc-section">setBackgroundColor
  256. <li><a class="reference" href="#setBackgroundColor.t%2CBackgroundColor" title="setBackgroundColor(bg: BackgroundColor; bright = false)">setBackgroundColor(bg: BackgroundColor; bright = false)</a></li>
  257. <li><a class="reference" href="#setBackgroundColor.t%2CColor" title="setBackgroundColor(color: Color)">setBackgroundColor(color: Color)</a></li>
  258. </ul>
  259. <ul class="simple nested-toc-section">setCursorPos
  260. <li><a class="reference" href="#setCursorPos.t%2Cint%2Cint" title="setCursorPos(x, y: int)">setCursorPos(x, y: int)</a></li>
  261. </ul>
  262. <ul class="simple nested-toc-section">setCursorXPos
  263. <li><a class="reference" href="#setCursorXPos.t%2Cint" title="setCursorXPos(x: int)">setCursorXPos(x: int)</a></li>
  264. </ul>
  265. <ul class="simple nested-toc-section">setForegroundColor
  266. <li><a class="reference" href="#setForegroundColor.t%2CColor" title="setForegroundColor(color: Color)">setForegroundColor(color: Color)</a></li>
  267. <li><a class="reference" href="#setForegroundColor.t%2CForegroundColor" title="setForegroundColor(fg: ForegroundColor; bright = false)">setForegroundColor(fg: ForegroundColor; bright = false)</a></li>
  268. </ul>
  269. <ul class="simple nested-toc-section">setStyle
  270. <li><a class="reference" href="#setStyle.t%2Cset%5BStyle%5D" title="setStyle(style: set[Style])">setStyle(style: set[Style])</a></li>
  271. </ul>
  272. <ul class="simple nested-toc-section">showCursor
  273. <li><a class="reference" href="#showCursor.t" title="showCursor()">showCursor()</a></li>
  274. </ul>
  275. <ul class="simple nested-toc-section">styledEcho
  276. <li><a class="reference" href="#styledEcho.t%2Cvarargs%5Buntyped%5D" title="styledEcho(args: varargs[untyped])">styledEcho(args: varargs[untyped])</a></li>
  277. </ul>
  278. <ul class="simple nested-toc-section">styledWriteLine
  279. <li><a class="reference" href="#styledWriteLine.t%2CFile%2Cvarargs%5Buntyped%5D" title="styledWriteLine(f: File; args: varargs[untyped])">styledWriteLine(f: File; args: varargs[untyped])</a></li>
  280. </ul>
  281. </ul>
  282. </details>
  283. </li>
  284. </ul>
  285. </div>
  286. <div class="nine columns" id="content">
  287. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  288. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  289. <div id="tocRoot"></div>
  290. <p class="module-desc">This module contains a few procedures to control the <em>terminal</em> (also called <em>console</em>). On UNIX, the implementation simply uses ANSI escape sequences and does not depend on any other module, on Windows it uses the Windows API. Changing the style is permanent even after program termination! Use the code <tt class="docutils literal"><span class="pre"><span class="Identifier">exitprocs</span><span class="Operator">.</span><span class="Identifier">addExitProc</span><span class="Punctuation">(</span><span class="Identifier">resetAttributes</span><span class="Punctuation">)</span></span></tt> to restore the defaults. Similarly, if you hide the cursor, make sure to unhide it with <tt class="docutils literal"><span class="pre"><span class="Identifier">showCursor</span></span></tt> before quitting.
  291. <h1><a class="toc-backref" id="progress-bar" href="#progress-bar">Progress bar</a></h1><p>Basic progress bar example:</p>
  292. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  293. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">terminal</span>
  294. <span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Punctuation">[</span><span class="Identifier">os</span><span class="Punctuation">,</span> <span class="Identifier">strutils</span><span class="Punctuation">]</span>
  295. <span class="Keyword">for</span> <span class="Identifier">i</span> <span class="Keyword">in</span> <span class="FloatNumber">0.</span><span class="Operator">.</span><span class="DecNumber">100</span><span class="Punctuation">:</span>
  296. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Identifier">fgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;0% &quot;</span><span class="Punctuation">,</span> <span class="Identifier">fgWhite</span><span class="Punctuation">,</span> <span class="CharLit">'#'</span><span class="Operator">.</span><span class="Identifier">repeat</span> <span class="Identifier">i</span><span class="Punctuation">,</span> <span class="Keyword">if</span> <span class="Identifier">i</span> <span class="Operator">&gt;</span> <span class="DecNumber">50</span><span class="Punctuation">:</span> <span class="Identifier">fgGreen</span> <span class="Keyword">else</span><span class="Punctuation">:</span> <span class="Identifier">fgYellow</span><span class="Punctuation">,</span> <span class="StringLit">&quot;</span><span class="EscapeSequence">\t</span><span class="StringLit">&quot;</span><span class="Punctuation">,</span> <span class="Operator">$</span><span class="Identifier">i</span> <span class="Punctuation">,</span> <span class="StringLit">&quot;%&quot;</span><span class="Punctuation">)</span>
  297. <span class="Identifier">sleep</span> <span class="DecNumber">42</span>
  298. <span class="Identifier">cursorUp</span> <span class="DecNumber">1</span>
  299. <span class="Identifier">eraseLine</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
  300. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">resetAttributes</span><span class="Punctuation">(</span><span class="Punctuation">)</span></pre>
  301. <h2><a class="toc-backref" id="progress-bar-playing-with-colorful-and-styled-text" href="#progress-bar-playing-with-colorful-and-styled-text">Playing with colorful and styled text</a></h2>Procs like <tt class="docutils literal"><span class="pre"><span class="Identifier">styledWriteLine</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">styledEcho</span></span></tt> etc. have a temporary effect on text parameters. Style parameters only affect the text parameter right after them. After being called, these procs will reset the default style of the terminal. While <tt class="docutils literal"><span class="pre"><span class="Identifier">setBackGroundColor</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">setForeGroundColor</span></span></tt> etc. have a lasting influence on the terminal, you can use <tt class="docutils literal"><span class="pre"><span class="Identifier">resetAttributes</span></span></tt> to reset the default style of the terminal.
  302. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  303. <pre class="listing"><span class="Keyword">import</span> <span class="Identifier">std</span><span class="Operator">/</span><span class="Identifier">terminal</span>
  304. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Punctuation">{</span><span class="Identifier">styleBright</span><span class="Punctuation">,</span> <span class="Identifier">styleBlink</span><span class="Punctuation">,</span> <span class="Identifier">styleUnderscore</span><span class="Punctuation">}</span><span class="Punctuation">,</span> <span class="StringLit">&quot;styled text &quot;</span><span class="Punctuation">)</span>
  305. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Identifier">fgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;red text &quot;</span><span class="Punctuation">)</span>
  306. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Identifier">fgWhite</span><span class="Punctuation">,</span> <span class="Identifier">bgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;white text in red background&quot;</span><span class="Punctuation">)</span>
  307. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="StringLit">&quot; ordinary text without style &quot;</span><span class="Punctuation">)</span>
  308. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">setBackGroundColor</span><span class="Punctuation">(</span><span class="Identifier">bgCyan</span><span class="Punctuation">,</span> <span class="Identifier">true</span><span class="Punctuation">)</span>
  309. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">setForeGroundColor</span><span class="Punctuation">(</span><span class="Identifier">fgBlue</span><span class="Punctuation">)</span>
  310. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">write</span><span class="Punctuation">(</span><span class="StringLit">&quot;blue text in cyan background&quot;</span><span class="Punctuation">)</span>
  311. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">resetAttributes</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
  312. <span class="Comment"># You can specify multiple text parameters. Style parameters</span>
  313. <span class="Comment"># only affect the text parameter right after them.</span>
  314. <span class="Identifier">styledEcho</span> <span class="Identifier">styleBright</span><span class="Punctuation">,</span> <span class="Identifier">fgGreen</span><span class="Punctuation">,</span> <span class="StringLit">&quot;[PASS]&quot;</span><span class="Punctuation">,</span> <span class="Identifier">resetStyle</span><span class="Punctuation">,</span> <span class="Identifier">fgGreen</span><span class="Punctuation">,</span> <span class="StringLit">&quot; Yay!&quot;</span>
  315. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Identifier">fgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;red text &quot;</span><span class="Punctuation">,</span> <span class="Identifier">styleBright</span><span class="Punctuation">,</span> <span class="StringLit">&quot;bold red&quot;</span><span class="Punctuation">,</span> <span class="Identifier">fgDefault</span><span class="Punctuation">,</span> <span class="StringLit">&quot; bold text&quot;</span><span class="Punctuation">)</span></pre></p>
  316. <div class="section" id="6">
  317. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  318. <dl class="item">
  319. <a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="strformat.html">strformat</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="colors.html">colors</a>, <a class="reference external" href="syncio.html">syncio</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="termios.html">termios</a>, <a class="reference external" href="posix.html">posix</a>, <a class="reference external" href="os.html">os</a>, <a class="reference external" href="parseutils.html">parseutils</a>, <a class="reference external" href="termios.html">termios</a>
  320. </dl>
  321. </div>
  322. <div class="section" id="7">
  323. <h1><a class="toc-backref" href="#7">Types</a></h1>
  324. <dl class="item">
  325. <div id="BackgroundColor">
  326. <dt><pre><a href="terminal.html#BackgroundColor"><span class="Identifier">BackgroundColor</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  327. <span class="Identifier">bgBlack</span> <span class="Other">=</span> <span class="DecNumber">40</span><span class="Other">,</span> <span class="Comment">## black</span>
  328. <span class="Identifier">bgRed</span><span class="Other">,</span> <span class="Comment">## red</span>
  329. <span class="Identifier">bgGreen</span><span class="Other">,</span> <span class="Comment">## green</span>
  330. <span class="Identifier">bgYellow</span><span class="Other">,</span> <span class="Comment">## yellow</span>
  331. <span class="Identifier">bgBlue</span><span class="Other">,</span> <span class="Comment">## blue</span>
  332. <span class="Identifier">bgMagenta</span><span class="Other">,</span> <span class="Comment">## magenta</span>
  333. <span class="Identifier">bgCyan</span><span class="Other">,</span> <span class="Comment">## cyan</span>
  334. <span class="Identifier">bgWhite</span><span class="Other">,</span> <span class="Comment">## white</span>
  335. <span class="Identifier">bg8Bit</span><span class="Other">,</span> <span class="Comment">## 256-color (not supported, see `enableTrueColors` instead.)</span>
  336. <span class="Identifier">bgDefault</span> <span class="Comment">## default terminal background color</span></pre></dt>
  337. <dd>
  338. Terminal's background colors.
  339. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L686" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  340. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L686" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  341. </dd>
  342. </div>
  343. <div id="ForegroundColor">
  344. <dt><pre><a href="terminal.html#ForegroundColor"><span class="Identifier">ForegroundColor</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  345. <span class="Identifier">fgBlack</span> <span class="Other">=</span> <span class="DecNumber">30</span><span class="Other">,</span> <span class="Comment">## black</span>
  346. <span class="Identifier">fgRed</span><span class="Other">,</span> <span class="Comment">## red</span>
  347. <span class="Identifier">fgGreen</span><span class="Other">,</span> <span class="Comment">## green</span>
  348. <span class="Identifier">fgYellow</span><span class="Other">,</span> <span class="Comment">## yellow</span>
  349. <span class="Identifier">fgBlue</span><span class="Other">,</span> <span class="Comment">## blue</span>
  350. <span class="Identifier">fgMagenta</span><span class="Other">,</span> <span class="Comment">## magenta</span>
  351. <span class="Identifier">fgCyan</span><span class="Other">,</span> <span class="Comment">## cyan</span>
  352. <span class="Identifier">fgWhite</span><span class="Other">,</span> <span class="Comment">## white</span>
  353. <span class="Identifier">fg8Bit</span><span class="Other">,</span> <span class="Comment">## 256-color (not supported, see `enableTrueColors` instead.)</span>
  354. <span class="Identifier">fgDefault</span> <span class="Comment">## default terminal foreground color</span></pre></dt>
  355. <dd>
  356. Terminal's foreground colors.
  357. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L674" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  358. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L674" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  359. </dd>
  360. </div>
  361. <div id="Style">
  362. <dt><pre><a href="terminal.html#Style"><span class="Identifier">Style</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  363. <span class="Identifier">styleBright</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">,</span> <span class="Comment">## bright text</span>
  364. <span class="Identifier">styleDim</span><span class="Other">,</span> <span class="Comment">## dim text</span>
  365. <span class="Identifier">styleItalic</span><span class="Other">,</span> <span class="Comment">## italic (or reverse on terminals not supporting)</span>
  366. <span class="Identifier">styleUnderscore</span><span class="Other">,</span> <span class="Comment">## underscored text</span>
  367. <span class="Identifier">styleBlink</span><span class="Other">,</span> <span class="Comment">## blinking/bold text</span>
  368. <span class="Identifier">styleBlinkRapid</span><span class="Other">,</span> <span class="Comment">## rapid blinking/bold text (not widely supported)</span>
  369. <span class="Identifier">styleReverse</span><span class="Other">,</span> <span class="Comment">## reverse</span>
  370. <span class="Identifier">styleHidden</span><span class="Other">,</span> <span class="Comment">## hidden text</span>
  371. <span class="Identifier">styleStrikethrough</span> <span class="Comment">## strikethrough</span></pre></dt>
  372. <dd>
  373. Different styles for text output.
  374. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L620" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  375. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L620" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  376. </dd>
  377. </div>
  378. <div id="TerminalCmd">
  379. <dt><pre><a href="terminal.html#TerminalCmd"><span class="Identifier">TerminalCmd</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
  380. <span class="Identifier">resetStyle</span><span class="Other">,</span> <span class="Comment">## reset attributes</span>
  381. <span class="Identifier">fgColor</span><span class="Other">,</span> <span class="Comment">## set foreground's true color</span>
  382. <span class="Identifier">bgColor</span> <span class="Comment">## set background's true color</span></pre></dt>
  383. <dd>
  384. commands that can be expressed as arguments
  385. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L815" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  386. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L815" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  387. </dd>
  388. </div>
  389. </dl>
  390. </div>
  391. <div class="section" id="10">
  392. <h1><a class="toc-backref" href="#10">Consts</a></h1>
  393. <dl class="item">
  394. <div id="ansiResetCode">
  395. <dt><pre><a href="terminal.html#ansiResetCode"><span class="Identifier">ansiResetCode</span></a> <span class="Other">=</span> <span class="StringLit">&quot;\e[0m&quot;</span></pre></dt>
  396. <dd>
  397. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  398. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  399. </dd>
  400. </div>
  401. </dl>
  402. </div>
  403. <div class="section" id="12">
  404. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  405. <dl class="item">
  406. <div id="ansiBackgroundColorCode-procs-all">
  407. <div id="ansiBackgroundColorCode,Color">
  408. <dt><pre><span class="Keyword">proc</span> <a href="#ansiBackgroundColorCode%2CColor"><span class="Identifier">ansiBackgroundColorCode</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  409. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  410. <dd>
  411. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L777" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  412. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L777" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  413. </dd>
  414. </div>
  415. </div>
  416. <div id="ansiForegroundColorCode-procs-all">
  417. <div id="ansiForegroundColorCode,Color">
  418. <dt><pre><span class="Keyword">proc</span> <a href="#ansiForegroundColorCode%2CColor"><span class="Identifier">ansiForegroundColorCode</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  419. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  420. <dd>
  421. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L768" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  422. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L768" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  423. </dd>
  424. </div>
  425. <div id="ansiForegroundColorCode,ForegroundColor">
  426. <dt><pre><span class="Keyword">proc</span> <a href="#ansiForegroundColorCode%2CForegroundColor"><span class="Identifier">ansiForegroundColorCode</span></a><span class="Other">(</span><span class="Identifier">fg</span><span class="Other">:</span> <a href="terminal.html#ForegroundColor"><span class="Identifier">ForegroundColor</span></a><span class="Other">;</span> <span class="Identifier">bright</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.
  427. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  428. <dd>
  429. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L759" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  430. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L759" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  431. </dd>
  432. </div>
  433. </div>
  434. <div id="ansiStyleCode-procs-all">
  435. <div id="ansiStyleCode,int">
  436. <dt><pre><span class="Keyword">proc</span> <a href="#ansiStyleCode%2Cint"><span class="Identifier">ansiStyleCode</span></a><span class="Other">(</span><span class="Identifier">style</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  437. <dd>
  438. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L631" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  439. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L631" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  440. </dd>
  441. </div>
  442. </div>
  443. <div id="cursorBackward-procs-all">
  444. <div id="cursorBackward,File,int">
  445. <dt><pre><span class="Keyword">proc</span> <a href="#cursorBackward%2CFile%2Cint"><span class="Identifier">cursorBackward</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  446. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  447. <dd>
  448. Moves the cursor backward by <tt class="docutils literal"><span class="pre"><span class="Identifier">count</span></span></tt> columns.
  449. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  450. <pre class="listing"><span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">cursorBackward</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
  451. <span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World!&quot;</span><span class="Punctuation">)</span> <span class="Comment"># anything written at that location will be erased/replaced with this</span></pre>
  452. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L509" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  453. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L509" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  454. </dd>
  455. </div>
  456. </div>
  457. <div id="cursorDown-procs-all">
  458. <div id="cursorDown,File,int">
  459. <dt><pre><span class="Keyword">proc</span> <a href="#cursorDown%2CFile%2Cint"><span class="Identifier">cursorDown</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  460. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  461. <dd>
  462. Moves the cursor down by <tt class="docutils literal"><span class="pre"><span class="Identifier">count</span></span></tt> rows.
  463. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  464. <pre class="listing"><span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">cursorDown</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
  465. <span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World!&quot;</span><span class="Punctuation">)</span> <span class="Comment"># anything written at that location will be erased/replaced with this</span></pre>
  466. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L483" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  467. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L483" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  468. </dd>
  469. </div>
  470. </div>
  471. <div id="cursorForward-procs-all">
  472. <div id="cursorForward,File,int">
  473. <dt><pre><span class="Keyword">proc</span> <a href="#cursorForward%2CFile%2Cint"><span class="Identifier">cursorForward</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  474. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  475. <dd>
  476. Moves the cursor forward by <tt class="docutils literal"><span class="pre"><span class="Identifier">count</span></span></tt> columns.
  477. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  478. <pre class="listing"><span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">cursorForward</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
  479. <span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World!&quot;</span><span class="Punctuation">)</span> <span class="Comment"># anything written at that location will be erased/replaced with this</span></pre>
  480. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L496" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  481. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L496" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  482. </dd>
  483. </div>
  484. </div>
  485. <div id="cursorUp-procs-all">
  486. <div id="cursorUp,File,int">
  487. <dt><pre><span class="Keyword">proc</span> <a href="#cursorUp%2CFile%2Cint"><span class="Identifier">cursorUp</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  488. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  489. <dd>
  490. Moves the cursor up by <tt class="docutils literal"><span class="pre"><span class="Identifier">count</span></span></tt> rows.
  491. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  492. <pre class="listing"><span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">cursorUp</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
  493. <span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Hello World!&quot;</span><span class="Punctuation">)</span> <span class="Comment"># anything written at that location will be erased/replaced with this</span></pre>
  494. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L470" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  495. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L470" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  496. </dd>
  497. </div>
  498. </div>
  499. <div id="disableTrueColors-procs-all">
  500. <div id="disableTrueColors">
  501. <dt><pre><span class="Keyword">proc</span> <a href="#disableTrueColors"><span class="Identifier">disableTrueColors</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  502. <dd>
  503. Disables true color.
  504. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L1016" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  505. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L1016" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  506. </dd>
  507. </div>
  508. </div>
  509. <div id="enableTrueColors-procs-all">
  510. <div id="enableTrueColors">
  511. <dt><pre><span class="Keyword">proc</span> <a href="#enableTrueColors"><span class="Identifier">enableTrueColors</span></a><span class="Other">(</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
  512. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  513. <dd>
  514. Enables true color.
  515. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L983" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  516. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L983" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  517. </dd>
  518. </div>
  519. </div>
  520. <div id="eraseLine-procs-all">
  521. <div id="eraseLine,File">
  522. <dt><pre><span class="Keyword">proc</span> <a href="#eraseLine%2CFile"><span class="Identifier">eraseLine</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  523. <dd>
  524. Erases the entire current line.
  525. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  526. <pre class="listing"><span class="Identifier">write</span><span class="Punctuation">(</span><span class="Identifier">stdout</span><span class="Punctuation">,</span> <span class="StringLit">&quot;never mind&quot;</span><span class="Punctuation">)</span>
  527. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">eraseLine</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Comment"># nothing will be printed on the screen</span></pre>
  528. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L553" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  529. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L553" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  530. </dd>
  531. </div>
  532. </div>
  533. <div id="eraseScreen-procs-all">
  534. <div id="eraseScreen,File">
  535. <dt><pre><span class="Keyword">proc</span> <a href="#eraseScreen%2CFile"><span class="Identifier">eraseScreen</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  536. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  537. <dd>
  538. Erases the screen with the background colour and moves the cursor to home.
  539. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L579" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  540. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L579" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  541. </dd>
  542. </div>
  543. </div>
  544. <div id="getch-procs-all">
  545. <div id="getch">
  546. <dt><pre><span class="Keyword">proc</span> <a href="#getch"><span class="Identifier">getch</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#char"><span class="Identifier">char</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  547. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  548. <dd>
  549. Reads a single character from the terminal, blocking until it is entered. The character is not printed to the terminal.
  550. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L878" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  551. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L878" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  552. </dd>
  553. </div>
  554. </div>
  555. <div id="getCursorPos-procs-all">
  556. <div id="getCursorPos">
  557. <dt><pre><span class="Keyword">proc</span> <a href="#getCursorPos"><span class="Identifier">getCursorPos</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a><span class="Other">,</span> <a href="exceptions.html#IOError"><span class="Identifier">IOError</span></a><span class="Other">]</span><span class="Other">,</span>
  558. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  559. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  560. <dd>
  561. Returns cursor position (x, y) writes to stdout and expects the terminal to respond via stdin
  562. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L274" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  563. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L274" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  564. </dd>
  565. </div>
  566. </div>
  567. <div id="hideCursor-procs-all">
  568. <div id="hideCursor,File">
  569. <dt><pre><span class="Keyword">proc</span> <a href="#hideCursor%2CFile"><span class="Identifier">hideCursor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  570. <dd>
  571. Hides the cursor.
  572. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L415" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  573. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L415" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  574. </dd>
  575. </div>
  576. </div>
  577. <div id="isatty-procs-all">
  578. <div id="isatty,File">
  579. <dt><pre><span class="Keyword">proc</span> <a href="#isatty%2CFile"><span class="Identifier">isatty</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  580. <dd>
  581. Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">f</span></span></tt> is associated with a terminal device.
  582. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L803" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  583. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L803" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  584. </dd>
  585. </div>
  586. </div>
  587. <div id="isTrueColorSupported-procs-all">
  588. <div id="isTrueColorSupported">
  589. <dt><pre><span class="Keyword">proc</span> <a href="#isTrueColorSupported"><span class="Identifier">isTrueColorSupported</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  590. <dd>
  591. Returns true if a terminal supports true color.
  592. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L976" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  593. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L976" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  594. </dd>
  595. </div>
  596. </div>
  597. <div id="readPasswordFromStdin-procs-all">
  598. <div id="readPasswordFromStdin,string">
  599. <dt><pre><span class="Keyword">proc</span> <a href="#readPasswordFromStdin%2Cstring"><span class="Identifier">readPasswordFromStdin</span></a><span class="Other">(</span><span class="Identifier">prompt</span> <span class="Other">=</span> <span class="StringLit">&quot;password: &quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  600. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  601. <dd>
  602. Reads a password from stdin without printing it.
  603. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L941" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  604. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L941" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  605. </dd>
  606. </div>
  607. <div id="readPasswordFromStdin,string,string">
  608. <dt><pre><span class="Keyword">proc</span> <a href="#readPasswordFromStdin%2Cstring%2Cstring"><span class="Identifier">readPasswordFromStdin</span></a><span class="Other">(</span><span class="Identifier">prompt</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">password</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.
  609. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><a href="exceptions.html#ReadIOEffect"><span class="Identifier">ReadIOEffect</span></a><span class="Other">,</span> <a href="exceptions.html#WriteIOEffect"><span class="Identifier">WriteIOEffect</span></a><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  610. <dd>
  611. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L927" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  612. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L927" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  613. </dd>
  614. </div>
  615. </div>
  616. <div id="resetAttributes-procs-all">
  617. <div id="resetAttributes">
  618. <dt><pre><span class="Keyword">proc</span> <a href="#resetAttributes"><span class="Identifier">resetAttributes</span></a><span class="Other">(</span><span class="Other">)</span> {.<span class="Identifier">noconv</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  619. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  620. <dd>
  621. Resets all attributes on stdout. It is advisable to register this as a quit proc with <tt class="docutils literal"><span class="pre"><span class="Identifier">exitprocs</span><span class="Operator">.</span><span class="Identifier">addExitProc</span><span class="Punctuation">(</span><span class="Identifier">resetAttributes</span><span class="Punctuation">)</span></span></tt>.
  622. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L970" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  623. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L970" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  624. </dd>
  625. </div>
  626. <div id="resetAttributes,File">
  627. <dt><pre><span class="Keyword">proc</span> <a href="#resetAttributes%2CFile"><span class="Identifier">resetAttributes</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  628. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  629. <dd>
  630. Resets all attributes.
  631. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L606" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  632. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L606" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  633. </dd>
  634. </div>
  635. </div>
  636. <div id="setBackgroundColor-procs-all">
  637. <div id="setBackgroundColor,File,BackgroundColor">
  638. <dt><pre><span class="Keyword">proc</span> <a href="#setBackgroundColor%2CFile%2CBackgroundColor"><span class="Identifier">setBackgroundColor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">bg</span><span class="Other">:</span> <a href="terminal.html#BackgroundColor"><span class="Identifier">BackgroundColor</span></a><span class="Other">;</span> <span class="Identifier">bright</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.
  639. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  640. <dd>
  641. Sets the terminal's background color.
  642. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L730" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  643. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L730" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  644. </dd>
  645. </div>
  646. <div id="setBackgroundColor,File,Color">
  647. <dt><pre><span class="Keyword">proc</span> <a href="#setBackgroundColor%2CFile%2CColor"><span class="Identifier">setBackgroundColor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  648. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  649. <dd>
  650. Sets the terminal's background true color.
  651. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L791" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  652. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L791" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  653. </dd>
  654. </div>
  655. </div>
  656. <div id="setCursorPos-procs-all">
  657. <div id="setCursorPos,File,int,int">
  658. <dt><pre><span class="Keyword">proc</span> <a href="#setCursorPos%2CFile%2Cint%2Cint"><span class="Identifier">setCursorPos</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  659. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  660. <dd>
  661. Sets the terminal's cursor to the (x,y) position. (0,0) is the upper left of the screen.
  662. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L429" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  663. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L429" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  664. </dd>
  665. </div>
  666. </div>
  667. <div id="setCursorXPos-procs-all">
  668. <div id="setCursorXPos,File,int">
  669. <dt><pre><span class="Keyword">proc</span> <a href="#setCursorXPos%2CFile%2Cint"><span class="Identifier">setCursorXPos</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span>
  670. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  671. <dd>
  672. Sets the terminal's cursor to the x position. The y position is not changed.
  673. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L438" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  674. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L438" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  675. </dd>
  676. </div>
  677. </div>
  678. <div id="setForegroundColor-procs-all">
  679. <div id="setForegroundColor,File,Color">
  680. <dt><pre><span class="Keyword">proc</span> <a href="#setForegroundColor%2CFile%2CColor"><span class="Identifier">setForegroundColor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  681. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  682. <dd>
  683. Sets the terminal's foreground true color.
  684. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L786" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  685. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L786" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  686. </dd>
  687. </div>
  688. <div id="setForegroundColor,File,ForegroundColor">
  689. <dt><pre><span class="Keyword">proc</span> <a href="#setForegroundColor%2CFile%2CForegroundColor"><span class="Identifier">setForegroundColor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">fg</span><span class="Other">:</span> <a href="terminal.html#ForegroundColor"><span class="Identifier">ForegroundColor</span></a><span class="Other">;</span> <span class="Identifier">bright</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span> {.
  690. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  691. <dd>
  692. Sets the terminal's foreground color.
  693. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L701" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  694. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L701" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  695. </dd>
  696. </div>
  697. </div>
  698. <div id="setStyle-procs-all">
  699. <div id="setStyle,File,set[Style]">
  700. <dt><pre><span class="Keyword">proc</span> <a href="#setStyle%2CFile%2Cset%5BStyle%5D"><span class="Identifier">setStyle</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">style</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="terminal.html#Style"><span class="Identifier">Style</span></a><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span>
  701. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  702. <dd>
  703. Sets the terminal style.
  704. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L641" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  705. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L641" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  706. </dd>
  707. </div>
  708. </div>
  709. <div id="showCursor-procs-all">
  710. <div id="showCursor,File">
  711. <dt><pre><span class="Keyword">proc</span> <a href="#showCursor%2CFile"><span class="Identifier">showCursor</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  712. <dd>
  713. Shows the cursor.
  714. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L422" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  715. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L422" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  716. </dd>
  717. </div>
  718. </div>
  719. <div id="terminalHeight-procs-all">
  720. <div id="terminalHeight">
  721. <dt><pre><span class="Keyword">proc</span> <a href="#terminalHeight"><span class="Identifier">terminalHeight</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  722. <dd>
  723. Returns some reasonable terminal height from either standard file descriptors, controlling terminal, environment variables or tradition. Zero is returned if the height could not be determined.
  724. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L366" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  725. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L366" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  726. </dd>
  727. </div>
  728. </div>
  729. <div id="terminalHeightIoctl-procs-all">
  730. <div id="terminalHeightIoctl,openArray[int]">
  731. <dt><pre><span class="Keyword">proc</span> <a href="#terminalHeightIoctl%2CopenArray%5Bint%5D"><span class="Identifier">terminalHeightIoctl</span></a><span class="Other">(</span><span class="Identifier">fds</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  732. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  733. <dd>
  734. Returns terminal height from first fd that supports the ioctl.
  735. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L325" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  736. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L325" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  737. </dd>
  738. </div>
  739. </div>
  740. <div id="terminalSize-procs-all">
  741. <div id="terminalSize">
  742. <dt><pre><span class="Keyword">proc</span> <a href="#terminalSize"><span class="Identifier">terminalSize</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">w</span><span class="Other">,</span> <span class="Identifier">h</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span>
  743. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  744. <dd>
  745. Returns the terminal width and height as a tuple. Internally calls <tt class="docutils literal"><span class="pre"><span class="Identifier">terminalWidth</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">terminalHeight</span></span></tt>, so the same assumptions apply.
  746. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L400" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  747. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L400" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  748. </dd>
  749. </div>
  750. </div>
  751. <div id="terminalWidth-procs-all">
  752. <div id="terminalWidth">
  753. <dt><pre><span class="Keyword">proc</span> <a href="#terminalWidth"><span class="Identifier">terminalWidth</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  754. <dd>
  755. Returns some reasonable terminal width from either standard file descriptors, controlling terminal, environment variables or tradition.
  756. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L336" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  757. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L336" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  758. </dd>
  759. </div>
  760. </div>
  761. <div id="terminalWidthIoctl-procs-all">
  762. <div id="terminalWidthIoctl,openArray[int]">
  763. <dt><pre><span class="Keyword">proc</span> <a href="#terminalWidthIoctl%2CopenArray%5Bint%5D"><span class="Identifier">terminalWidthIoctl</span></a><span class="Other">(</span><span class="Identifier">fds</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  764. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  765. <dd>
  766. Returns terminal width from first fd that supports the ioctl.
  767. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L316" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  768. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L316" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  769. </dd>
  770. </div>
  771. </div>
  772. <div id="writeStyled-procs-all">
  773. <div id="writeStyled,string,set[Style]">
  774. <dt><pre><span class="Keyword">proc</span> <a href="#writeStyled%2Cstring%2Cset%5BStyle%5D"><span class="Identifier">writeStyled</span></a><span class="Other">(</span><span class="Identifier">txt</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">style</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="terminal.html#Style"><span class="Identifier">Style</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Identifier">styleBright</span><span class="Other">}</span><span class="Other">)</span> {.
  775. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">IOError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">WriteIOEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  776. <dd>
  777. Writes the text <tt class="docutils literal"><span class="pre"><span class="Identifier">txt</span></span></tt> in a given <tt class="docutils literal"><span class="pre"><span class="Identifier">style</span></span></tt> to stdout.
  778. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L656" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  779. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L656" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  780. </dd>
  781. </div>
  782. </div>
  783. </dl>
  784. </div>
  785. <div class="section" id="17">
  786. <h1><a class="toc-backref" href="#17">Macros</a></h1>
  787. <dl class="item">
  788. <div id="styledWrite-macros-all">
  789. <div id="styledWrite.m,File,varargs[typed]">
  790. <dt><pre><span class="Keyword">macro</span> <a href="#styledWrite.m%2CFile%2Cvarargs%5Btyped%5D"><span class="Identifier">styledWrite</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">m</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#typed"><span class="Identifier">typed</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#untyped"><span class="Identifier">untyped</span></a></pre></dt>
  791. <dd>
  792. Similar to <tt class="docutils literal"><span class="pre"><span class="Identifier">write</span></span></tt>, but treating terminal style arguments specially. When some argument is <tt class="docutils literal"><span class="pre"><span class="Identifier">Style</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">set</span><span class="Punctuation">[</span><span class="Identifier">Style</span><span class="Punctuation">]</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">ForegroundColor</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">BackgroundColor</span></span></tt> or <tt class="docutils literal"><span class="pre"><span class="Identifier">TerminalCmd</span></span></tt> then it is not sent directly to <tt class="docutils literal"><span class="pre"><span class="Identifier">f</span></span></tt>, but instead corresponding terminal style proc is called.
  793. <p><strong class="examples_text">Example: cmd: -r:off</strong></p>
  794. <pre class="listing"><span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWrite</span><span class="Punctuation">(</span><span class="Identifier">fgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;red text &quot;</span><span class="Punctuation">)</span>
  795. <span class="Identifier">stdout</span><span class="Operator">.</span><span class="Identifier">styledWrite</span><span class="Punctuation">(</span><span class="Identifier">fgGreen</span><span class="Punctuation">,</span> <span class="StringLit">&quot;green text&quot;</span><span class="Punctuation">)</span></pre>
  796. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L836" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  797. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L836" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  798. </dd>
  799. </div>
  800. </div>
  801. </dl>
  802. </div>
  803. <div class="section" id="18">
  804. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  805. <dl class="item">
  806. <div id="ansiBackgroundColorCode-templates-all">
  807. <div id="ansiBackgroundColorCode.t,static[Color]">
  808. <dt><pre><span class="Keyword">template</span> <a href="#ansiBackgroundColorCode.t%2Cstatic%5BColor%5D"><span class="Identifier">ansiBackgroundColorCode</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="system.html#static"><span class="Identifier">static</span></a><span class="Other">[</span><a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  809. <dd>
  810. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L781" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  811. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L781" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  812. </dd>
  813. </div>
  814. </div>
  815. <div id="ansiForegroundColorCode-templates-all">
  816. <div id="ansiForegroundColorCode.t,static[Color]">
  817. <dt><pre><span class="Keyword">template</span> <a href="#ansiForegroundColorCode.t%2Cstatic%5BColor%5D"><span class="Identifier">ansiForegroundColorCode</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="system.html#static"><span class="Identifier">static</span></a><span class="Other">[</span><a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  818. <dd>
  819. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L772" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  820. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L772" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  821. </dd>
  822. </div>
  823. <div id="ansiForegroundColorCode.t,static[ForegroundColor],static[bool]">
  824. <dt><pre><span class="Keyword">template</span> <a href="#ansiForegroundColorCode.t%2Cstatic%5BForegroundColor%5D%2Cstatic%5Bbool%5D"><span class="Identifier">ansiForegroundColorCode</span></a><span class="Other">(</span><span class="Identifier">fg</span><span class="Other">:</span> <a href="system.html#static"><span class="Identifier">static</span></a><span class="Other">[</span><a href="terminal.html#ForegroundColor"><span class="Identifier">ForegroundColor</span></a><span class="Other">]</span><span class="Other">;</span>
  825. <span class="Identifier">bright</span><span class="Other">:</span> <a href="system.html#static"><span class="Identifier">static</span></a><span class="Other">[</span><a href="system.html#bool"><span class="Identifier">bool</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  826. <dd>
  827. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L764" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  828. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L764" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  829. </dd>
  830. </div>
  831. </div>
  832. <div id="ansiStyleCode-templates-all">
  833. <div id="ansiStyleCode.t,static[Style]">
  834. <dt><pre><span class="Keyword">template</span> <a href="#ansiStyleCode.t%2Cstatic%5BStyle%5D"><span class="Identifier">ansiStyleCode</span></a><span class="Other">(</span><span class="Identifier">style</span><span class="Other">:</span> <a href="system.html#static"><span class="Identifier">static</span></a><span class="Other">[</span><a href="terminal.html#Style"><span class="Identifier">Style</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  835. <dd>
  836. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L638" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  837. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L638" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  838. </dd>
  839. </div>
  840. <div id="ansiStyleCode.t,Style">
  841. <dt><pre><span class="Keyword">template</span> <a href="#ansiStyleCode.t%2CStyle"><span class="Identifier">ansiStyleCode</span></a><span class="Other">(</span><span class="Identifier">style</span><span class="Other">:</span> <a href="terminal.html#Style"><span class="Identifier">Style</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  842. <dd>
  843. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L634" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  844. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L634" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  845. </dd>
  846. </div>
  847. </div>
  848. <div id="cursorBackward-templates-all">
  849. <div id="cursorBackward.t,int">
  850. <dt><pre><span class="Keyword">template</span> <a href="#cursorBackward.t%2Cint"><span class="Identifier">cursorBackward</span></a><span class="Other">(</span><span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span></pre></dt>
  851. <dd>
  852. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L957" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  853. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L957" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  854. </dd>
  855. </div>
  856. </div>
  857. <div id="cursorDown-templates-all">
  858. <div id="cursorDown.t,int">
  859. <dt><pre><span class="Keyword">template</span> <a href="#cursorDown.t%2Cint"><span class="Identifier">cursorDown</span></a><span class="Other">(</span><span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span></pre></dt>
  860. <dd>
  861. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L955" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  862. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L955" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  863. </dd>
  864. </div>
  865. </div>
  866. <div id="cursorForward-templates-all">
  867. <div id="cursorForward.t,int">
  868. <dt><pre><span class="Keyword">template</span> <a href="#cursorForward.t%2Cint"><span class="Identifier">cursorForward</span></a><span class="Other">(</span><span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span></pre></dt>
  869. <dd>
  870. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L956" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  871. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L956" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  872. </dd>
  873. </div>
  874. </div>
  875. <div id="cursorUp-templates-all">
  876. <div id="cursorUp.t,int">
  877. <dt><pre><span class="Keyword">template</span> <a href="#cursorUp.t%2Cint"><span class="Identifier">cursorUp</span></a><span class="Other">(</span><span class="Identifier">count</span> <span class="Other">=</span> <span class="DecNumber">1</span><span class="Other">)</span></pre></dt>
  878. <dd>
  879. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L954" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  880. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L954" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  881. </dd>
  882. </div>
  883. </div>
  884. <div id="eraseLine-templates-all">
  885. <div id="eraseLine.t">
  886. <dt><pre><span class="Keyword">template</span> <a href="#eraseLine.t"><span class="Identifier">eraseLine</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
  887. <dd>
  888. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L958" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  889. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L958" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  890. </dd>
  891. </div>
  892. </div>
  893. <div id="eraseScreen-templates-all">
  894. <div id="eraseScreen.t">
  895. <dt><pre><span class="Keyword">template</span> <a href="#eraseScreen.t"><span class="Identifier">eraseScreen</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
  896. <dd>
  897. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L959" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  898. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L959" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  899. </dd>
  900. </div>
  901. </div>
  902. <div id="hideCursor-templates-all">
  903. <div id="hideCursor.t">
  904. <dt><pre><span class="Keyword">template</span> <a href="#hideCursor.t"><span class="Identifier">hideCursor</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
  905. <dd>
  906. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L948" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  907. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L948" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  908. </dd>
  909. </div>
  910. </div>
  911. <div id="setBackgroundColor-templates-all">
  912. <div id="setBackgroundColor.t,BackgroundColor">
  913. <dt><pre><span class="Keyword">template</span> <a href="#setBackgroundColor.t%2CBackgroundColor"><span class="Identifier">setBackgroundColor</span></a><span class="Other">(</span><span class="Identifier">bg</span><span class="Other">:</span> <a href="terminal.html#BackgroundColor"><span class="Identifier">BackgroundColor</span></a><span class="Other">;</span> <span class="Identifier">bright</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span></pre></dt>
  914. <dd>
  915. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L964" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  916. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L964" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  917. </dd>
  918. </div>
  919. <div id="setBackgroundColor.t,Color">
  920. <dt><pre><span class="Keyword">template</span> <a href="#setBackgroundColor.t%2CColor"><span class="Identifier">setBackgroundColor</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span></pre></dt>
  921. <dd>
  922. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L968" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  923. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L968" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  924. </dd>
  925. </div>
  926. </div>
  927. <div id="setCursorPos-templates-all">
  928. <div id="setCursorPos.t,int,int">
  929. <dt><pre><span class="Keyword">template</span> <a href="#setCursorPos.t%2Cint%2Cint"><span class="Identifier">setCursorPos</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">,</span> <span class="Identifier">y</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span></pre></dt>
  930. <dd>
  931. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L950" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  932. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L950" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  933. </dd>
  934. </div>
  935. </div>
  936. <div id="setCursorXPos-templates-all">
  937. <div id="setCursorXPos.t,int">
  938. <dt><pre><span class="Keyword">template</span> <a href="#setCursorXPos.t%2Cint"><span class="Identifier">setCursorXPos</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span></pre></dt>
  939. <dd>
  940. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L951" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  941. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L951" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  942. </dd>
  943. </div>
  944. </div>
  945. <div id="setForegroundColor-templates-all">
  946. <div id="setForegroundColor.t,Color">
  947. <dt><pre><span class="Keyword">template</span> <a href="#setForegroundColor.t%2CColor"><span class="Identifier">setForegroundColor</span></a><span class="Other">(</span><span class="Identifier">color</span><span class="Other">:</span> <a href="colors.html#Color"><span class="Identifier">Color</span></a><span class="Other">)</span></pre></dt>
  948. <dd>
  949. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L966" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  950. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L966" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  951. </dd>
  952. </div>
  953. <div id="setForegroundColor.t,ForegroundColor">
  954. <dt><pre><span class="Keyword">template</span> <a href="#setForegroundColor.t%2CForegroundColor"><span class="Identifier">setForegroundColor</span></a><span class="Other">(</span><span class="Identifier">fg</span><span class="Other">:</span> <a href="terminal.html#ForegroundColor"><span class="Identifier">ForegroundColor</span></a><span class="Other">;</span> <span class="Identifier">bright</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span></pre></dt>
  955. <dd>
  956. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L962" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  957. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L962" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  958. </dd>
  959. </div>
  960. </div>
  961. <div id="setStyle-templates-all">
  962. <div id="setStyle.t,set[Style]">
  963. <dt><pre><span class="Keyword">template</span> <a href="#setStyle.t%2Cset%5BStyle%5D"><span class="Identifier">setStyle</span></a><span class="Other">(</span><span class="Identifier">style</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><a href="terminal.html#Style"><span class="Identifier">Style</span></a><span class="Other">]</span><span class="Other">)</span></pre></dt>
  964. <dd>
  965. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L960" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  966. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L960" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  967. </dd>
  968. </div>
  969. </div>
  970. <div id="showCursor-templates-all">
  971. <div id="showCursor.t">
  972. <dt><pre><span class="Keyword">template</span> <a href="#showCursor.t"><span class="Identifier">showCursor</span></a><span class="Other">(</span><span class="Other">)</span></pre></dt>
  973. <dd>
  974. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L949" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  975. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L949" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  976. </dd>
  977. </div>
  978. </div>
  979. <div id="styledEcho-templates-all">
  980. <div id="styledEcho.t,varargs[untyped]">
  981. <dt><pre><span class="Keyword">template</span> <a href="#styledEcho.t%2Cvarargs%5Buntyped%5D"><span class="Identifier">styledEcho</span></a><span class="Other">(</span><span class="Identifier">args</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">]</span><span class="Other">)</span></pre></dt>
  982. <dd>
  983. Echoes styles arguments to stdout using <tt class="docutils literal"><span class="pre"><span class="Identifier">styledWriteLine</span></span></tt>.
  984. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L874" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  985. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L874" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  986. </dd>
  987. </div>
  988. </div>
  989. <div id="styledWriteLine-templates-all">
  990. <div id="styledWriteLine.t,File,varargs[untyped]">
  991. <dt><pre><span class="Keyword">template</span> <a href="#styledWriteLine.t%2CFile%2Cvarargs%5Buntyped%5D"><span class="Identifier">styledWriteLine</span></a><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="syncio.html#File"><span class="Identifier">File</span></a><span class="Other">;</span> <span class="Identifier">args</span><span class="Other">:</span> <a href="system.html#varargs"><span class="Identifier">varargs</span></a><span class="Other">[</span><a href="system.html#untyped"><span class="Identifier">untyped</span></a><span class="Other">]</span><span class="Other">)</span></pre></dt>
  992. <dd>
  993. Calls <tt class="docutils literal"><span class="pre"><span class="Identifier">styledWrite</span></span></tt> and appends a newline at the end.
  994. <p><strong class="examples_text">Example:</strong></p>
  995. <pre class="listing"><span class="Keyword">proc</span> <span class="Identifier">error</span><span class="Punctuation">(</span><span class="Identifier">msg</span><span class="Punctuation">:</span> <span class="Identifier">string</span><span class="Punctuation">)</span> <span class="Operator">=</span>
  996. <span class="Identifier">styledWriteLine</span><span class="Punctuation">(</span><span class="Identifier">stderr</span><span class="Punctuation">,</span> <span class="Identifier">fgRed</span><span class="Punctuation">,</span> <span class="StringLit">&quot;Error: &quot;</span><span class="Punctuation">,</span> <span class="Identifier">resetStyle</span><span class="Punctuation">,</span> <span class="Identifier">msg</span><span class="Punctuation">)</span></pre>
  997. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/terminal.nim#L865" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  998. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/terminal.nim#L865" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  999. </dd>
  1000. </div>
  1001. </div>
  1002. </dl>
  1003. </div>
  1004. </div>
  1005. </div>
  1006. <div class="twelve-columns footer">
  1007. <span class="nim-sprite"></span>
  1008. <br>
  1009. <small style="color: var(--hint);">Made with Nim. Generated: 2025-02-06 22:28:02 UTC</small>
  1010. </div>
  1011. </div>
  1012. </div>
  1013. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  1014. </body>
  1015. </html>