xref: /freebsd-src/contrib/bsddialog/lib/bsddialog_theme.h (revision 61ba55bcf70f2340f9c943c9571113b3fd8eda69)
1c76f0793SBaptiste Daroussin /*-
2c76f0793SBaptiste Daroussin  * SPDX-License-Identifier: BSD-2-Clause
3c76f0793SBaptiste Daroussin  *
4*61ba55bcSBaptiste Daroussin  * Copyright (c) 2021-2023 Alfonso Sabato Siciliano
5c76f0793SBaptiste Daroussin  *
6c76f0793SBaptiste Daroussin  * Redistribution and use in source and binary forms, with or without
7c76f0793SBaptiste Daroussin  * modification, are permitted provided that the following conditions
8c76f0793SBaptiste Daroussin  * are met:
9c76f0793SBaptiste Daroussin  * 1. Redistributions of source code must retain the above copyright
10c76f0793SBaptiste Daroussin  *    notice, this list of conditions and the following disclaimer.
11c76f0793SBaptiste Daroussin  * 2. Redistributions in binary form must reproduce the above copyright
12c76f0793SBaptiste Daroussin  *    notice, this list of conditions and the following disclaimer in the
13c76f0793SBaptiste Daroussin  *    documentation and/or other materials provided with the distribution.
14c76f0793SBaptiste Daroussin  *
15c76f0793SBaptiste Daroussin  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16c76f0793SBaptiste Daroussin  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17c76f0793SBaptiste Daroussin  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18c76f0793SBaptiste Daroussin  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19c76f0793SBaptiste Daroussin  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20c76f0793SBaptiste Daroussin  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21c76f0793SBaptiste Daroussin  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22c76f0793SBaptiste Daroussin  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23c76f0793SBaptiste Daroussin  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24c76f0793SBaptiste Daroussin  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25c76f0793SBaptiste Daroussin  * SUCH DAMAGE.
26c76f0793SBaptiste Daroussin  */
27c76f0793SBaptiste Daroussin 
28c76f0793SBaptiste Daroussin #ifndef _LIBBSDDIALOG_THEME_H_
29c76f0793SBaptiste Daroussin #define _LIBBSDDIALOG_THEME_H_
30c76f0793SBaptiste Daroussin 
31263660c0SAlfonso Siciliano /* color flags */
32*61ba55bcSBaptiste Daroussin #define BSDDIALOG_BLINK       1U
33*61ba55bcSBaptiste Daroussin #define BSDDIALOG_BOLD        2U
34*61ba55bcSBaptiste Daroussin #define BSDDIALOG_HALFBRIGHT  4U
35*61ba55bcSBaptiste Daroussin #define BSDDIALOG_HIGHLIGHT   8U
36*61ba55bcSBaptiste Daroussin #define BSDDIALOG_REVERSE    16U
37*61ba55bcSBaptiste Daroussin #define BSDDIALOG_UNDERLINE  32U
38263660c0SAlfonso Siciliano 
39c76f0793SBaptiste Daroussin struct bsddialog_theme {
40f499134dSBaptiste Daroussin 	struct {
41f499134dSBaptiste Daroussin 		int color;
42263660c0SAlfonso Siciliano 	} screen;
43f499134dSBaptiste Daroussin 	struct {
44f499134dSBaptiste Daroussin 		int color;
45b319d934SAlfonso S. Siciliano 		unsigned int y;
46b319d934SAlfonso S. Siciliano 		unsigned int x;
47f499134dSBaptiste Daroussin 	} shadow;
48f499134dSBaptiste Daroussin 	struct {
49f499134dSBaptiste Daroussin 		int  color;
50f499134dSBaptiste Daroussin 		bool delimtitle;
51c76f0793SBaptiste Daroussin 		int  titlecolor;
52c76f0793SBaptiste Daroussin 		int  lineraisecolor;
53c76f0793SBaptiste Daroussin 		int  linelowercolor;
54f499134dSBaptiste Daroussin 		int  bottomtitlecolor;
55bce40c02SAlfonso S. Siciliano 		int  arrowcolor;
568c4f4028SBaptiste Daroussin 	} dialog;
57f499134dSBaptiste Daroussin 	struct {
58*61ba55bcSBaptiste Daroussin 		int f_prefixcolor;
59*61ba55bcSBaptiste Daroussin 		int prefixcolor;
60bce40c02SAlfonso S. Siciliano 		int f_selectorcolor;
618c4f4028SBaptiste Daroussin 		int selectorcolor;
62f499134dSBaptiste Daroussin 		int f_namecolor;
63f499134dSBaptiste Daroussin 		int namecolor;
64f499134dSBaptiste Daroussin 		int f_desccolor;
65f499134dSBaptiste Daroussin 		int desccolor;
668c4f4028SBaptiste Daroussin 		int f_shortcutcolor;
678c4f4028SBaptiste Daroussin 		int shortcutcolor;
68b319d934SAlfonso S. Siciliano 		int bottomdesccolor;
69*61ba55bcSBaptiste Daroussin 		int sepnamecolor;
70*61ba55bcSBaptiste Daroussin 		int sepdesccolor;
71f499134dSBaptiste Daroussin 	} menu;
72f499134dSBaptiste Daroussin 	struct {
73f499134dSBaptiste Daroussin 		int f_fieldcolor;
74c76f0793SBaptiste Daroussin 		int fieldcolor;
75f499134dSBaptiste Daroussin 		int readonlycolor;
76b319d934SAlfonso S. Siciliano 		int bottomdesccolor;
77f499134dSBaptiste Daroussin 	} form;
78f499134dSBaptiste Daroussin 	struct {
79f499134dSBaptiste Daroussin 		int f_color;
80f499134dSBaptiste Daroussin 		int color;
81f499134dSBaptiste Daroussin 	} bar;
82f499134dSBaptiste Daroussin 	struct {
83b319d934SAlfonso S. Siciliano 		unsigned int minmargin;
84b319d934SAlfonso S. Siciliano 		unsigned int maxmargin;
85b319d934SAlfonso S. Siciliano 		char leftdelim;
86b319d934SAlfonso S. Siciliano 		char rightdelim;
87f499134dSBaptiste Daroussin 		int f_delimcolor;
88*61ba55bcSBaptiste Daroussin 		int delimcolor;
89f499134dSBaptiste Daroussin 		int f_color;
90*61ba55bcSBaptiste Daroussin 		int color;
91f499134dSBaptiste Daroussin 		int f_shortcutcolor;
92*61ba55bcSBaptiste Daroussin 		int shortcutcolor;
93f499134dSBaptiste Daroussin 	} button;
94c76f0793SBaptiste Daroussin };
95c76f0793SBaptiste Daroussin 
96c76f0793SBaptiste Daroussin enum bsddialog_default_theme {
97*61ba55bcSBaptiste Daroussin 	BSDDIALOG_THEME_3D,
98c76f0793SBaptiste Daroussin 	BSDDIALOG_THEME_BLACKWHITE,
99*61ba55bcSBaptiste Daroussin 	BSDDIALOG_THEME_FLAT
100c76f0793SBaptiste Daroussin };
101c76f0793SBaptiste Daroussin 
1028c4f4028SBaptiste Daroussin enum bsddialog_color {
1038c4f4028SBaptiste Daroussin 	BSDDIALOG_BLACK = 0,
1048c4f4028SBaptiste Daroussin 	BSDDIALOG_RED,
1058c4f4028SBaptiste Daroussin 	BSDDIALOG_GREEN,
1068c4f4028SBaptiste Daroussin 	BSDDIALOG_YELLOW,
1078c4f4028SBaptiste Daroussin 	BSDDIALOG_BLUE,
1088c4f4028SBaptiste Daroussin 	BSDDIALOG_MAGENTA,
1098c4f4028SBaptiste Daroussin 	BSDDIALOG_CYAN,
110263660c0SAlfonso Siciliano 	BSDDIALOG_WHITE
1118c4f4028SBaptiste Daroussin };
1128c4f4028SBaptiste Daroussin 
113f499134dSBaptiste Daroussin int
114d93b4d32SBaptiste Daroussin bsddialog_color(enum bsddialog_color foreground,
115d93b4d32SBaptiste Daroussin     enum bsddialog_color background, unsigned int flags);
116b319d934SAlfonso S. Siciliano int
117b319d934SAlfonso S. Siciliano bsddialog_color_attrs(int color, enum bsddialog_color *foreground,
118b319d934SAlfonso S. Siciliano     enum bsddialog_color *background, unsigned int *flags);
1198c4f4028SBaptiste Daroussin int bsddialog_get_theme(struct bsddialog_theme *theme);
120b319d934SAlfonso S. Siciliano bool bsddialog_hascolors(void);
121c76f0793SBaptiste Daroussin int bsddialog_set_default_theme(enum bsddialog_default_theme theme);
1228c4f4028SBaptiste Daroussin int bsddialog_set_theme(struct bsddialog_theme *theme);
123c76f0793SBaptiste Daroussin 
124c76f0793SBaptiste Daroussin #endif