]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/lua/color.lua.8
Switch direct rt fields access in rtsock.c to newly-create field acessors.
[FreeBSD/FreeBSD.git] / stand / lua / color.lua.8
1 .\"
2 .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 .\"
4 .\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD$
28 .\"
29 .Dd August 19, 2018
30 .Dt COLOR.LUA 8
31 .Os
32 .Sh NAME
33 .Nm color.lua
34 .Nd FreeBSD color module
35 .Sh DESCRIPTION
36 .Nm
37 contains functionality for working with colors.
38 .Pp
39 Before using the functionality provided by
40 .Nm ,
41 it must be included with a statement such as the following:
42 .Pp
43 .Dl local color = require("color")
44 .Pp
45 The following color constants are exported from
46 .Nm :
47 .Bl -tag -width "Ic color.MAGENTA" -offset indent
48 .It Ic color.BLACK
49 .It Ic color.RED
50 .It Ic color.GREEN
51 .It Ic color.YELLOW
52 .It Ic color.BLUE
53 .It Ic color.MAGENTA
54 .It Ic color.CYAN
55 .It Ic color.WHITE
56 .El
57 .Pp
58 The following attribute constants are exported from
59 .Nm :
60 .Bl -tag -width "Ic color.DEFAULT" -offset indent
61 .It Ic color.DEFAULT
62 .It Ic color.BRIGHT
63 .It Ic color.DIM
64 .El
65 .Pp
66 The following functions are exported from
67 .Nm :
68 .Bl -tag -width "Fn color.isEnabled" -offset indent
69 .It Fn color.isEnabled
70 Returns True if
71 .Xr loader 8
72 has been configured to not allow color, False otherwise.
73 This checks the
74 .Ev loader_color
75 .Xr loader.conf 5
76 variable, along with
77 .Fn core.isSerialBoot .
78 .It Fn color.escapefg color_value
79 Returns the escape sequence that encodes
80 .Fa color_value
81 as a foreground color.
82 .Fn color.escapefg
83 returns an empty string if color is disabled.
84 .It Fn color.resetfg
85 Returns the escape sequence for the default foreground color.
86 .Fn color.resetfg
87 returns an empty string if color is disabled.
88 .It Fn color.escapebg color_value
89 Returns the escape sequence that encodes
90 .Fa color_value
91 as a background color.
92 .Fn color.escapebg
93 returns an empty string if color is disabled.
94 .It Fn color.resetbg
95 Returns the escape sequence for the default background color.
96 .Fn color.resetbg
97 returns an empty string if color is disabled.
98 .It Fn color.escape fg_color bg_color attribute
99 Returns an escape sequence that encodes
100 .Fa fg_color
101 as the foreground color,
102 .Fa bg_color
103 as the background color, and
104 .Fa attribute
105 applied.
106 .Fn color.escape
107 returns an empty string if color is disabled.
108 .It Fn color.default
109 Returns the escape sequence for the default color scheme, white on black with
110 no attributes applied.
111 .Fn color.default
112 returns an empty string if color is disabled.
113 .It Fn color.highlight str
114 Returns
115 .Fa str
116 with the
117 .Ic color.BRIGHT
118 attribute applied before it and reset after it.
119 .Fn color.highlight
120 returns
121 .Fa str
122 if color is disabled.
123 .El
124 .Sh SEE ALSO
125 .Xr screen.lua 8
126 .Sh AUTHORS
127 The
128 .Nm
129 file was originally written by
130 .An Pedro Souza Aq Mt pedrosouza@FreeBSD.org .
131 Later work and this manual page was done by
132 .An Kyle Evans Aq Mt kevans@FreeBSD.org .