ocaml-containers/dev/containers/CCFormat/ANSI_codes/index.html
2021-08-04 20:54:21 +00:00

3 lines
No EOL
5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>ANSI_codes (containers.CCFormat.ANSI_codes)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">CCFormat</a> &#x00BB; ANSI_codes</nav><h1>Module <code>CCFormat.ANSI_codes</code></h1><p>ANSI escape codes. This contains lower level functions for them.</p><dl><dt>since</dt><dd>3.5</dd></dl></header><dl><dt class="spec type" id="type-color"><a href="#type-color" class="anchor"></a><code><span class="keyword">type</span> color</code> = <code>[ </code><table class="variant"><tr id="type-color.Black" class="anchored"><td class="def constructor"><a href="#type-color.Black" class="anchor"></a><code>| </code><code>`Black</code></td></tr><tr id="type-color.Red" class="anchored"><td class="def constructor"><a href="#type-color.Red" class="anchor"></a><code>| </code><code>`Red</code></td></tr><tr id="type-color.Yellow" class="anchored"><td class="def constructor"><a href="#type-color.Yellow" class="anchor"></a><code>| </code><code>`Yellow</code></td></tr><tr id="type-color.Green" class="anchored"><td class="def constructor"><a href="#type-color.Green" class="anchor"></a><code>| </code><code>`Green</code></td></tr><tr id="type-color.Blue" class="anchored"><td class="def constructor"><a href="#type-color.Blue" class="anchor"></a><code>| </code><code>`Blue</code></td></tr><tr id="type-color.Magenta" class="anchored"><td class="def constructor"><a href="#type-color.Magenta" class="anchor"></a><code>| </code><code>`Magenta</code></td></tr><tr id="type-color.Cyan" class="anchored"><td class="def constructor"><a href="#type-color.Cyan" class="anchor"></a><code>| </code><code>`Cyan</code></td></tr><tr id="type-color.White" class="anchored"><td class="def constructor"><a href="#type-color.White" class="anchor"></a><code>| </code><code>`White</code></td></tr></table><code> ]</code></dt><dd><p>An ANSI color</p></dd></dl><dl><dt class="spec type" id="type-style"><a href="#type-style" class="anchor"></a><code><span class="keyword">type</span> style</code> = <code>[ </code><table class="variant"><tr id="type-style.FG" class="anchored"><td class="def constructor"><a href="#type-style.FG" class="anchor"></a><code>| </code><code>`FG <span class="keyword">of</span> <a href="index.html#type-color">color</a></code></td><td class="doc"><p>foreground</p></td></tr><tr id="type-style.BG" class="anchored"><td class="def constructor"><a href="#type-style.BG" class="anchor"></a><code>| </code><code>`BG <span class="keyword">of</span> <a href="index.html#type-color">color</a></code></td><td class="doc"><p>background</p></td></tr><tr id="type-style.Bold" class="anchored"><td class="def constructor"><a href="#type-style.Bold" class="anchor"></a><code>| </code><code>`Bold</code></td></tr><tr id="type-style.Reset" class="anchored"><td class="def constructor"><a href="#type-style.Reset" class="anchor"></a><code>| </code><code>`Reset</code></td></tr></table><code> ]</code></dt><dd><p>A style. Styles can be composed in a list.</p></dd></dl><dl><dt class="spec value" id="val-clear_line"><a href="#val-clear_line" class="anchor"></a><code><span class="keyword">val</span> clear_line : string</code></dt><dd><p><code>clear_line</code> is an escape code to clear the current line. It is very useful for progress bars; for example:</p><pre><code class="ml">let pp_progress i =
Printf.printf &quot;%sprogress at %d%!&quot; ANSI_codes.clear_line i</code></pre><p>if called repeatedly this will print successive progress messages on a single line.</p></dd></dl><dl><dt class="spec value" id="val-reset"><a href="#val-reset" class="anchor"></a><code><span class="keyword">val</span> reset : string</code></dt><dd><p>The escape code to reset style (colors, bold, etc.)</p></dd></dl><dl><dt class="spec value" id="val-string_of_style"><a href="#val-string_of_style" class="anchor"></a><code><span class="keyword">val</span> string_of_style : <a href="index.html#type-style">style</a> <span>&#45;&gt;</span> string</code></dt><dd><p><code>string_of_style st</code> is an escape code to set the current style to <code>st</code>. It can be printed as is on any output that is a compatible terminal.</p></dd></dl><dl><dt class="spec value" id="val-string_of_style_list"><a href="#val-string_of_style_list" class="anchor"></a><code><span class="keyword">val</span> string_of_style_list : <span><a href="index.html#type-style">style</a> list</span> <span>&#45;&gt;</span> string</code></dt><dd><p><code>string_of_style_list styles</code> is an escape code for multiple styles at once. For example <code>string_of_style_list ANSI_codes.([`FG `Red; `BG `Green; `Bold])</code> is a very shiny style.</p></dd></dl></div></body></html>