ocaml-containers/dev/containers/CCFormat/ANSI_codes/index.html
2023-02-15 10:05:53 +00:00

3 lines
No EOL
5.8 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 2.2.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">CCFormat</a> &#x00BB; ANSI_codes</nav><header class="odoc-preamble"><h1>Module <code><span>CCFormat.ANSI_codes</span></code></h1><p>ANSI escape codes. This contains lower level functions for them.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.5</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-color"><a href="#type-color" class="anchor"></a><code><span><span class="keyword">type</span> color</span><span> = </span><span>[ </span></code><ol><li id="type-color.Black" class="def constructor anchored"><a href="#type-color.Black" class="anchor"></a><code><span>| </span></code><code><span>`Black</span></code></li><li id="type-color.Red" class="def constructor anchored"><a href="#type-color.Red" class="anchor"></a><code><span>| </span></code><code><span>`Red</span></code></li><li id="type-color.Yellow" class="def constructor anchored"><a href="#type-color.Yellow" class="anchor"></a><code><span>| </span></code><code><span>`Yellow</span></code></li><li id="type-color.Green" class="def constructor anchored"><a href="#type-color.Green" class="anchor"></a><code><span>| </span></code><code><span>`Green</span></code></li><li id="type-color.Blue" class="def constructor anchored"><a href="#type-color.Blue" class="anchor"></a><code><span>| </span></code><code><span>`Blue</span></code></li><li id="type-color.Magenta" class="def constructor anchored"><a href="#type-color.Magenta" class="anchor"></a><code><span>| </span></code><code><span>`Magenta</span></code></li><li id="type-color.Cyan" class="def constructor anchored"><a href="#type-color.Cyan" class="anchor"></a><code><span>| </span></code><code><span>`Cyan</span></code></li><li id="type-color.White" class="def constructor anchored"><a href="#type-color.White" class="anchor"></a><code><span>| </span></code><code><span>`White</span></code></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>An ANSI color</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-style"><a href="#type-style" class="anchor"></a><code><span><span class="keyword">type</span> style</span><span> = </span><span>[ </span></code><ol><li id="type-style.FG" class="def constructor anchored"><a href="#type-style.FG" class="anchor"></a><code><span>| </span></code><code><span>`FG <span class="keyword">of</span> <a href="#type-color">color</a></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>foreground</p><span class="comment-delim">*)</span></div></li><li id="type-style.BG" class="def constructor anchored"><a href="#type-style.BG" class="anchor"></a><code><span>| </span></code><code><span>`BG <span class="keyword">of</span> <a href="#type-color">color</a></span></code><div class="def-doc"><span class="comment-delim">(*</span><p>background</p><span class="comment-delim">*)</span></div></li><li id="type-style.Bold" class="def constructor anchored"><a href="#type-style.Bold" class="anchor"></a><code><span>| </span></code><code><span>`Bold</span></code></li><li id="type-style.Reset" class="def constructor anchored"><a href="#type-style.Reset" class="anchor"></a><code><span>| </span></code><code><span>`Reset</span></code></li></ol><code><span> ]</span></code></div><div class="spec-doc"><p>A style. Styles can be composed in a list.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-clear_line"><a href="#val-clear_line" class="anchor"></a><code><span><span class="keyword">val</span> clear_line : string</span></code></div><div class="spec-doc"><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 class="language-ocaml"><code>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></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-reset"><a href="#val-reset" class="anchor"></a><code><span><span class="keyword">val</span> reset : string</span></code></div><div class="spec-doc"><p>The escape code to reset style (colors, bold, etc.)</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_style"><a href="#val-string_of_style" class="anchor"></a><code><span><span class="keyword">val</span> string_of_style : <span><a href="#type-style">style</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><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></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-string_of_style_list"><a href="#val-string_of_style_list" class="anchor"></a><code><span><span class="keyword">val</span> string_of_style_list : <span><span><a href="#type-style">style</a> list</span> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><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></div></div></div></body></html>