1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2021 Alfonso Sabato Siciliano 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 28 #ifndef _LIBBSDDIALOG_THEME_H_ 29 #define _LIBBSDDIALOG_THEME_H_ 30 31 enum bsddialog_color { 32 BSDDIALOG_BLACK = 0, 33 BSDDIALOG_RED, 34 BSDDIALOG_GREEN, 35 BSDDIALOG_YELLOW, 36 BSDDIALOG_BLUE, 37 BSDDIALOG_MAGENTA, 38 BSDDIALOG_CYAN, 39 BSDDIALOG_WHITE, 40 }; 41 42 /* f_ for focus/selected/active/current element */ 43 struct bsddialog_theme { 44 struct { 45 int color; 46 } terminal; 47 48 struct { 49 int color; 50 unsigned int h; 51 unsigned int w; 52 } shadow; 53 54 struct { 55 int color; 56 bool delimtitle; 57 int titlecolor; 58 int lineraisecolor; 59 int linelowercolor; 60 int bottomtitlecolor; 61 } widget; 62 63 struct { 64 unsigned int hmargin; 65 } text; 66 67 struct { 68 int arrowcolor; 69 int f_namecolor; 70 int namecolor; 71 int f_desccolor; 72 int desccolor; 73 int namesepcolor; 74 int descsepcolor; 75 } menu; 76 77 struct { 78 int f_fieldcolor; 79 int fieldcolor; 80 int readonlycolor; 81 } form; 82 83 struct { 84 int f_color; 85 int color; 86 } bar; 87 88 struct { 89 unsigned int space; 90 int leftch; 91 int rightch; 92 int delimcolor; 93 int f_delimcolor; 94 int color; 95 int f_color; 96 int shortcutcolor; 97 int f_shortcutcolor; 98 } button; 99 }; 100 101 enum bsddialog_default_theme { 102 BSDDIALOG_THEME_BLACKWHITE, 103 BSDDIALOG_THEME_BSDDIALOG, 104 BSDDIALOG_THEME_DEFAULT, 105 BSDDIALOG_THEME_DIALOG, 106 }; 107 108 int 109 bsddialog_color(enum bsddialog_color background, 110 enum bsddialog_color foreground); 111 struct bsddialog_theme bsddialog_get_theme(void); 112 void bsddialog_set_theme(struct bsddialog_theme theme); 113 int bsddialog_set_default_theme(enum bsddialog_default_theme theme); 114 115 #endif 116