175658c96SKyle Evans.\" 2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause 375658c96SKyle Evans.\" 475658c96SKyle Evans.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> 575658c96SKyle Evans.\" 675658c96SKyle Evans.\" Redistribution and use in source and binary forms, with or without 775658c96SKyle Evans.\" modification, are permitted provided that the following conditions 875658c96SKyle Evans.\" are met: 975658c96SKyle Evans.\" 1. Redistributions of source code must retain the above copyright 1075658c96SKyle Evans.\" notice, this list of conditions and the following disclaimer. 1175658c96SKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright 1275658c96SKyle Evans.\" notice, this list of conditions and the following disclaimer in the 1375658c96SKyle Evans.\" documentation and/or other materials provided with the distribution. 1475658c96SKyle Evans.\" 1575658c96SKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1675658c96SKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1775658c96SKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1875658c96SKyle Evans.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1975658c96SKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2075658c96SKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2175658c96SKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2275658c96SKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2375658c96SKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2475658c96SKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2575658c96SKyle Evans.\" SUCH DAMAGE. 2675658c96SKyle Evans.\" 2775658c96SKyle Evans.Dd August 19, 2018 2875658c96SKyle Evans.Dt COLOR.LUA 8 2975658c96SKyle Evans.Os 3075658c96SKyle Evans.Sh NAME 3175658c96SKyle Evans.Nm color.lua 3275658c96SKyle Evans.Nd FreeBSD color module 3375658c96SKyle Evans.Sh DESCRIPTION 3475658c96SKyle Evans.Nm 3575658c96SKyle Evanscontains functionality for working with colors. 3675658c96SKyle Evans.Pp 3775658c96SKyle EvansBefore using the functionality provided by 3875658c96SKyle Evans.Nm , 3975658c96SKyle Evansit must be included with a statement such as the following: 4075658c96SKyle Evans.Pp 4175658c96SKyle Evans.Dl local color = require("color") 4275658c96SKyle Evans.Pp 4375658c96SKyle EvansThe following color constants are exported from 4475658c96SKyle Evans.Nm : 4575658c96SKyle Evans.Bl -tag -width "Ic color.MAGENTA" -offset indent 4675658c96SKyle Evans.It Ic color.BLACK 4775658c96SKyle Evans.It Ic color.RED 4875658c96SKyle Evans.It Ic color.GREEN 4975658c96SKyle Evans.It Ic color.YELLOW 5075658c96SKyle Evans.It Ic color.BLUE 5175658c96SKyle Evans.It Ic color.MAGENTA 5275658c96SKyle Evans.It Ic color.CYAN 5375658c96SKyle Evans.It Ic color.WHITE 5475658c96SKyle Evans.El 5575658c96SKyle Evans.Pp 5675658c96SKyle EvansThe following attribute constants are exported from 5775658c96SKyle Evans.Nm : 5875658c96SKyle Evans.Bl -tag -width "Ic color.DEFAULT" -offset indent 5975658c96SKyle Evans.It Ic color.DEFAULT 6075658c96SKyle Evans.It Ic color.BRIGHT 6175658c96SKyle Evans.It Ic color.DIM 6275658c96SKyle Evans.El 6375658c96SKyle Evans.Pp 6475658c96SKyle EvansThe following functions are exported from 6575658c96SKyle Evans.Nm : 6675658c96SKyle Evans.Bl -tag -width "Fn color.isEnabled" -offset indent 6775658c96SKyle Evans.It Fn color.isEnabled 6875658c96SKyle EvansReturns True if 6975658c96SKyle Evans.Xr loader 8 7075658c96SKyle Evanshas been configured to not allow color, False otherwise. 7175658c96SKyle EvansThis checks the 7275658c96SKyle Evans.Ev loader_color 7375658c96SKyle Evans.Xr loader.conf 5 7475658c96SKyle Evansvariable, along with 7575658c96SKyle Evans.Fn core.isSerialBoot . 7675658c96SKyle Evans.It Fn color.escapefg color_value 7775658c96SKyle EvansReturns the escape sequence that encodes 7875658c96SKyle Evans.Fa color_value 7975658c96SKyle Evansas a foreground color. 8075658c96SKyle Evans.Fn color.escapefg 8175658c96SKyle Evansreturns an empty string if color is disabled. 8275658c96SKyle Evans.It Fn color.resetfg 8375658c96SKyle EvansReturns the escape sequence for the default foreground color. 8475658c96SKyle Evans.Fn color.resetfg 8575658c96SKyle Evansreturns an empty string if color is disabled. 8675658c96SKyle Evans.It Fn color.escapebg color_value 8775658c96SKyle EvansReturns the escape sequence that encodes 8875658c96SKyle Evans.Fa color_value 8975658c96SKyle Evansas a background color. 9075658c96SKyle Evans.Fn color.escapebg 9175658c96SKyle Evansreturns an empty string if color is disabled. 9275658c96SKyle Evans.It Fn color.resetbg 9375658c96SKyle EvansReturns the escape sequence for the default background color. 9475658c96SKyle Evans.Fn color.resetbg 9575658c96SKyle Evansreturns an empty string if color is disabled. 9675658c96SKyle Evans.It Fn color.escape fg_color bg_color attribute 9775658c96SKyle EvansReturns an escape sequence that encodes 9875658c96SKyle Evans.Fa fg_color 9975658c96SKyle Evansas the foreground color, 10075658c96SKyle Evans.Fa bg_color 10175658c96SKyle Evansas the background color, and 10275658c96SKyle Evans.Fa attribute 10375658c96SKyle Evansapplied. 10475658c96SKyle Evans.Fn color.escape 10575658c96SKyle Evansreturns an empty string if color is disabled. 10675658c96SKyle Evans.It Fn color.default 10775658c96SKyle EvansReturns the escape sequence for the default color scheme, white on black with 10875658c96SKyle Evansno attributes applied. 10975658c96SKyle Evans.Fn color.default 11075658c96SKyle Evansreturns an empty string if color is disabled. 11175658c96SKyle Evans.It Fn color.highlight str 11275658c96SKyle EvansReturns 11375658c96SKyle Evans.Fa str 11475658c96SKyle Evanswith the 11575658c96SKyle Evans.Ic color.BRIGHT 11675658c96SKyle Evansattribute applied before it and reset after it. 11775658c96SKyle Evans.Fn color.highlight 11875658c96SKyle Evansreturns 11975658c96SKyle Evans.Fa str 12075658c96SKyle Evansif color is disabled. 12175658c96SKyle Evans.El 12275658c96SKyle Evans.Sh SEE ALSO 12375658c96SKyle Evans.Xr screen.lua 8 12475658c96SKyle Evans.Sh AUTHORS 12575658c96SKyle EvansThe 12675658c96SKyle Evans.Nm 12775658c96SKyle Evansfile was originally written by 12875658c96SKyle Evans.An Pedro Souza Aq Mt pedrosouza@FreeBSD.org . 12975658c96SKyle EvansLater work and this manual page was done by 13075658c96SKyle Evans.An Kyle Evans Aq Mt kevans@FreeBSD.org . 131