1*c76f0793SBaptiste Daroussin /*- 2*c76f0793SBaptiste Daroussin * SPDX-License-Identifier: BSD-2-Clause 3*c76f0793SBaptiste Daroussin * 4*c76f0793SBaptiste Daroussin * Copyright (c) 2021 Alfonso Sabato Siciliano 5*c76f0793SBaptiste Daroussin * 6*c76f0793SBaptiste Daroussin * Redistribution and use in source and binary forms, with or without 7*c76f0793SBaptiste Daroussin * modification, are permitted provided that the following conditions 8*c76f0793SBaptiste Daroussin * are met: 9*c76f0793SBaptiste Daroussin * 1. Redistributions of source code must retain the above copyright 10*c76f0793SBaptiste Daroussin * notice, this list of conditions and the following disclaimer. 11*c76f0793SBaptiste Daroussin * 2. Redistributions in binary form must reproduce the above copyright 12*c76f0793SBaptiste Daroussin * notice, this list of conditions and the following disclaimer in the 13*c76f0793SBaptiste Daroussin * documentation and/or other materials provided with the distribution. 14*c76f0793SBaptiste Daroussin * 15*c76f0793SBaptiste Daroussin * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16*c76f0793SBaptiste Daroussin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*c76f0793SBaptiste Daroussin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*c76f0793SBaptiste Daroussin * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19*c76f0793SBaptiste Daroussin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20*c76f0793SBaptiste Daroussin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21*c76f0793SBaptiste Daroussin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22*c76f0793SBaptiste Daroussin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23*c76f0793SBaptiste Daroussin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24*c76f0793SBaptiste Daroussin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25*c76f0793SBaptiste Daroussin * SUCH DAMAGE. 26*c76f0793SBaptiste Daroussin */ 27*c76f0793SBaptiste Daroussin 28*c76f0793SBaptiste Daroussin #ifdef PORTNCURSES 29*c76f0793SBaptiste Daroussin #include <ncurses/curses.h> 30*c76f0793SBaptiste Daroussin #else 31*c76f0793SBaptiste Daroussin #include <curses.h> 32*c76f0793SBaptiste Daroussin #endif 33*c76f0793SBaptiste Daroussin 34*c76f0793SBaptiste Daroussin #include "bsddialog.h" 35*c76f0793SBaptiste Daroussin #include "lib_util.h" 36*c76f0793SBaptiste Daroussin #include "bsddialog_theme.h" 37*c76f0793SBaptiste Daroussin 38*c76f0793SBaptiste Daroussin #define GET_COLOR(bg, fg) (COLOR_PAIR(bg * 8 + fg +1)) 39*c76f0793SBaptiste Daroussin 40*c76f0793SBaptiste Daroussin struct bsddialog_theme t; 41*c76f0793SBaptiste Daroussin 42*c76f0793SBaptiste Daroussin static struct bsddialog_theme bsddialogtheme = { 43*c76f0793SBaptiste Daroussin #define bgwidget COLOR_WHITE 44*c76f0793SBaptiste Daroussin #define bgcurr COLOR_YELLOW 45*c76f0793SBaptiste Daroussin .shadowcolor = GET_COLOR(COLOR_BLACK, COLOR_BLACK), 46*c76f0793SBaptiste Daroussin .shadowrows = 1, 47*c76f0793SBaptiste Daroussin .shadowcols = 2, 48*c76f0793SBaptiste Daroussin 49*c76f0793SBaptiste Daroussin .backgroundcolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 50*c76f0793SBaptiste Daroussin .surroundtitle = true, 51*c76f0793SBaptiste Daroussin .titlecolor = GET_COLOR(COLOR_YELLOW, bgwidget), 52*c76f0793SBaptiste Daroussin .lineraisecolor = GET_COLOR(COLOR_BLACK, bgwidget), 53*c76f0793SBaptiste Daroussin .linelowercolor = GET_COLOR(COLOR_BLACK, bgwidget), 54*c76f0793SBaptiste Daroussin .widgetcolor = GET_COLOR(COLOR_BLACK, bgwidget), 55*c76f0793SBaptiste Daroussin 56*c76f0793SBaptiste Daroussin .texthmargin = 1, 57*c76f0793SBaptiste Daroussin 58*c76f0793SBaptiste Daroussin .curritemcolor = GET_COLOR(COLOR_WHITE, bgcurr), 59*c76f0793SBaptiste Daroussin .itemcolor = GET_COLOR(COLOR_BLACK, bgwidget), 60*c76f0793SBaptiste Daroussin .currtagcolor = GET_COLOR(COLOR_BLACK, bgcurr), 61*c76f0793SBaptiste Daroussin .tagcolor = GET_COLOR(COLOR_YELLOW, bgwidget), 62*c76f0793SBaptiste Daroussin .namesepcolor = GET_COLOR(COLOR_YELLOW, bgwidget), 63*c76f0793SBaptiste Daroussin .descsepcolor = GET_COLOR(COLOR_YELLOW, bgwidget), 64*c76f0793SBaptiste Daroussin 65*c76f0793SBaptiste Daroussin .currfieldcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE), 66*c76f0793SBaptiste Daroussin .fieldcolor = GET_COLOR(COLOR_WHITE, COLOR_CYAN), 67*c76f0793SBaptiste Daroussin .fieldreadonlycolor = GET_COLOR(COLOR_CYAN,COLOR_WHITE), 68*c76f0793SBaptiste Daroussin 69*c76f0793SBaptiste Daroussin .currbarcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE), 70*c76f0793SBaptiste Daroussin .barcolor = GET_COLOR(COLOR_BLUE, COLOR_WHITE), 71*c76f0793SBaptiste Daroussin 72*c76f0793SBaptiste Daroussin .buttonspace = 3, 73*c76f0793SBaptiste Daroussin .buttleftch = '[', 74*c76f0793SBaptiste Daroussin .buttrightchar = ']', 75*c76f0793SBaptiste Daroussin .currbuttdelimcolor = GET_COLOR(COLOR_WHITE, bgcurr), 76*c76f0793SBaptiste Daroussin .buttdelimcolor = GET_COLOR(COLOR_BLACK, bgwidget), 77*c76f0793SBaptiste Daroussin .currbuttoncolor = GET_COLOR(COLOR_WHITE, bgcurr) | A_UNDERLINE, 78*c76f0793SBaptiste Daroussin .buttoncolor = GET_COLOR(COLOR_BLACK, bgwidget) | A_UNDERLINE, 79*c76f0793SBaptiste Daroussin .currshortkeycolor = GET_COLOR(COLOR_BLACK, bgcurr) | A_UNDERLINE, 80*c76f0793SBaptiste Daroussin .shortkeycolor = GET_COLOR(COLOR_YELLOW, bgwidget) | A_UNDERLINE, 81*c76f0793SBaptiste Daroussin 82*c76f0793SBaptiste Daroussin .bottomtitlecolor= GET_COLOR(COLOR_BLACK, bgwidget) 83*c76f0793SBaptiste Daroussin }; 84*c76f0793SBaptiste Daroussin 85*c76f0793SBaptiste Daroussin static struct bsddialog_theme blackwhite = { 86*c76f0793SBaptiste Daroussin #define bk COLOR_BLACK 87*c76f0793SBaptiste Daroussin #define fg COLOR_WHITE 88*c76f0793SBaptiste Daroussin .shadowcolor = GET_COLOR(COLOR_BLACK, COLOR_BLACK), 89*c76f0793SBaptiste Daroussin .shadowrows = 1, 90*c76f0793SBaptiste Daroussin .shadowcols = 2, 91*c76f0793SBaptiste Daroussin 92*c76f0793SBaptiste Daroussin .backgroundcolor = GET_COLOR(fg, bk), 93*c76f0793SBaptiste Daroussin .surroundtitle = true, 94*c76f0793SBaptiste Daroussin .titlecolor = GET_COLOR(fg, bk), 95*c76f0793SBaptiste Daroussin .lineraisecolor = GET_COLOR(fg, bk), 96*c76f0793SBaptiste Daroussin .linelowercolor = GET_COLOR(fg, bk), 97*c76f0793SBaptiste Daroussin .widgetcolor = GET_COLOR(fg, bk), 98*c76f0793SBaptiste Daroussin 99*c76f0793SBaptiste Daroussin .texthmargin = 1, 100*c76f0793SBaptiste Daroussin 101*c76f0793SBaptiste Daroussin .curritemcolor = GET_COLOR(fg, bk) | A_REVERSE, 102*c76f0793SBaptiste Daroussin .itemcolor = GET_COLOR(fg, bk), 103*c76f0793SBaptiste Daroussin .currtagcolor = GET_COLOR(fg, bk) | A_REVERSE, 104*c76f0793SBaptiste Daroussin .tagcolor = GET_COLOR(fg, bk), 105*c76f0793SBaptiste Daroussin .namesepcolor = GET_COLOR(fg, bk), 106*c76f0793SBaptiste Daroussin .descsepcolor = GET_COLOR(fg, bk), 107*c76f0793SBaptiste Daroussin 108*c76f0793SBaptiste Daroussin .currfieldcolor = GET_COLOR(fg, bk) | A_REVERSE, 109*c76f0793SBaptiste Daroussin .fieldcolor = GET_COLOR(fg, bk), 110*c76f0793SBaptiste Daroussin .fieldreadonlycolor = GET_COLOR(fg, bk), 111*c76f0793SBaptiste Daroussin 112*c76f0793SBaptiste Daroussin .currbarcolor = GET_COLOR(fg, bk) | A_REVERSE, 113*c76f0793SBaptiste Daroussin .barcolor = GET_COLOR(fg, bk), 114*c76f0793SBaptiste Daroussin 115*c76f0793SBaptiste Daroussin .buttonspace = 3, 116*c76f0793SBaptiste Daroussin .buttleftch = '[', 117*c76f0793SBaptiste Daroussin .buttrightchar = ']', 118*c76f0793SBaptiste Daroussin .currbuttdelimcolor = GET_COLOR(fg, bk), 119*c76f0793SBaptiste Daroussin .buttdelimcolor = GET_COLOR(fg, bk), 120*c76f0793SBaptiste Daroussin .currbuttoncolor = GET_COLOR(fg, bk) | A_UNDERLINE | A_REVERSE, 121*c76f0793SBaptiste Daroussin .buttoncolor = GET_COLOR(fg, bk) | A_UNDERLINE, 122*c76f0793SBaptiste Daroussin .currshortkeycolor = GET_COLOR(fg, bk) | A_UNDERLINE | A_REVERSE, 123*c76f0793SBaptiste Daroussin .shortkeycolor = GET_COLOR(fg, bk) | A_UNDERLINE, 124*c76f0793SBaptiste Daroussin 125*c76f0793SBaptiste Daroussin .bottomtitlecolor= GET_COLOR(fg, bk) 126*c76f0793SBaptiste Daroussin }; 127*c76f0793SBaptiste Daroussin 128*c76f0793SBaptiste Daroussin static struct bsddialog_theme dialogtheme = { 129*c76f0793SBaptiste Daroussin .shadowcolor = GET_COLOR(COLOR_BLACK, COLOR_BLACK), 130*c76f0793SBaptiste Daroussin .shadowrows = 1, 131*c76f0793SBaptiste Daroussin .shadowcols = 2, 132*c76f0793SBaptiste Daroussin 133*c76f0793SBaptiste Daroussin .backgroundcolor = GET_COLOR(COLOR_CYAN, COLOR_BLUE) | A_BOLD, 134*c76f0793SBaptiste Daroussin .surroundtitle = false, 135*c76f0793SBaptiste Daroussin .titlecolor = GET_COLOR(COLOR_BLUE, COLOR_WHITE) | A_BOLD, 136*c76f0793SBaptiste Daroussin .lineraisecolor = GET_COLOR(COLOR_WHITE, COLOR_WHITE) | A_BOLD, 137*c76f0793SBaptiste Daroussin .linelowercolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE) | A_BOLD, 138*c76f0793SBaptiste Daroussin .widgetcolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE), 139*c76f0793SBaptiste Daroussin 140*c76f0793SBaptiste Daroussin .texthmargin = 1, 141*c76f0793SBaptiste Daroussin 142*c76f0793SBaptiste Daroussin .curritemcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 143*c76f0793SBaptiste Daroussin .itemcolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE) | A_BOLD, 144*c76f0793SBaptiste Daroussin .currtagcolor = GET_COLOR(COLOR_YELLOW,COLOR_BLUE) | A_BOLD, 145*c76f0793SBaptiste Daroussin .tagcolor = GET_COLOR(COLOR_BLUE, COLOR_WHITE) | A_BOLD, 146*c76f0793SBaptiste Daroussin .namesepcolor = GET_COLOR(COLOR_RED, COLOR_WHITE), 147*c76f0793SBaptiste Daroussin .descsepcolor = GET_COLOR(COLOR_RED, COLOR_WHITE), 148*c76f0793SBaptiste Daroussin 149*c76f0793SBaptiste Daroussin .currfieldcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 150*c76f0793SBaptiste Daroussin .fieldcolor = GET_COLOR(COLOR_WHITE, COLOR_CYAN) | A_BOLD, 151*c76f0793SBaptiste Daroussin .fieldreadonlycolor = GET_COLOR(COLOR_CYAN,COLOR_WHITE)| A_BOLD, 152*c76f0793SBaptiste Daroussin 153*c76f0793SBaptiste Daroussin .currbarcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 154*c76f0793SBaptiste Daroussin .barcolor = GET_COLOR(COLOR_BLUE, COLOR_WHITE) | A_BOLD, 155*c76f0793SBaptiste Daroussin 156*c76f0793SBaptiste Daroussin .buttonspace = 3, 157*c76f0793SBaptiste Daroussin .buttleftch = '<', 158*c76f0793SBaptiste Daroussin .buttrightchar = '>', 159*c76f0793SBaptiste Daroussin .currbuttdelimcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 160*c76f0793SBaptiste Daroussin .buttdelimcolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE), 161*c76f0793SBaptiste Daroussin .currbuttoncolor = GET_COLOR(COLOR_YELLOW, COLOR_BLUE) | A_BOLD, 162*c76f0793SBaptiste Daroussin .buttoncolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE), 163*c76f0793SBaptiste Daroussin .currshortkeycolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 164*c76f0793SBaptiste Daroussin .shortkeycolor = GET_COLOR(COLOR_RED, COLOR_WHITE) | A_BOLD, 165*c76f0793SBaptiste Daroussin 166*c76f0793SBaptiste Daroussin .bottomtitlecolor = GET_COLOR(COLOR_BLACK, COLOR_WHITE) | A_BOLD 167*c76f0793SBaptiste Daroussin }; 168*c76f0793SBaptiste Daroussin 169*c76f0793SBaptiste Daroussin static struct bsddialog_theme magentatheme = { 170*c76f0793SBaptiste Daroussin .shadowcolor = GET_COLOR(COLOR_BLACK, COLOR_BLACK), 171*c76f0793SBaptiste Daroussin .shadowrows = 1, 172*c76f0793SBaptiste Daroussin .shadowcols = 2, 173*c76f0793SBaptiste Daroussin 174*c76f0793SBaptiste Daroussin .backgroundcolor = GET_COLOR(COLOR_WHITE, COLOR_MAGENTA) | A_BOLD, 175*c76f0793SBaptiste Daroussin .surroundtitle = true, 176*c76f0793SBaptiste Daroussin .titlecolor = GET_COLOR(COLOR_RED, COLOR_CYAN), 177*c76f0793SBaptiste Daroussin .lineraisecolor = GET_COLOR(COLOR_WHITE, COLOR_CYAN) | A_BOLD, 178*c76f0793SBaptiste Daroussin .linelowercolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 179*c76f0793SBaptiste Daroussin .widgetcolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 180*c76f0793SBaptiste Daroussin 181*c76f0793SBaptiste Daroussin .texthmargin = 1, 182*c76f0793SBaptiste Daroussin 183*c76f0793SBaptiste Daroussin .curritemcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 184*c76f0793SBaptiste Daroussin .itemcolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN) | A_BOLD, 185*c76f0793SBaptiste Daroussin .currtagcolor = GET_COLOR(COLOR_YELLOW,COLOR_BLUE) | A_BOLD, 186*c76f0793SBaptiste Daroussin .tagcolor = GET_COLOR(COLOR_BLUE, COLOR_CYAN) | A_BOLD, 187*c76f0793SBaptiste Daroussin .namesepcolor = GET_COLOR(COLOR_RED, COLOR_CYAN) | A_BOLD, 188*c76f0793SBaptiste Daroussin .descsepcolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN) | A_BOLD, 189*c76f0793SBaptiste Daroussin 190*c76f0793SBaptiste Daroussin .currfieldcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 191*c76f0793SBaptiste Daroussin .fieldcolor = GET_COLOR(COLOR_WHITE, COLOR_CYAN) | A_BOLD, 192*c76f0793SBaptiste Daroussin .fieldreadonlycolor = GET_COLOR(COLOR_CYAN,COLOR_WHITE)| A_BOLD, 193*c76f0793SBaptiste Daroussin 194*c76f0793SBaptiste Daroussin .currbarcolor = GET_COLOR(COLOR_WHITE, COLOR_BLUE) | A_BOLD, 195*c76f0793SBaptiste Daroussin .barcolor = GET_COLOR(COLOR_BLUE, COLOR_WHITE) | A_BOLD, 196*c76f0793SBaptiste Daroussin 197*c76f0793SBaptiste Daroussin .buttonspace = 3, 198*c76f0793SBaptiste Daroussin .buttleftch = '<', 199*c76f0793SBaptiste Daroussin .buttrightchar = '>', 200*c76f0793SBaptiste Daroussin .currbuttdelimcolor = GET_COLOR(COLOR_WHITE, COLOR_RED) | A_BOLD, 201*c76f0793SBaptiste Daroussin .buttdelimcolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 202*c76f0793SBaptiste Daroussin .currbuttoncolor = GET_COLOR(COLOR_WHITE, COLOR_RED), 203*c76f0793SBaptiste Daroussin .buttoncolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 204*c76f0793SBaptiste Daroussin .currshortkeycolor = GET_COLOR(COLOR_WHITE, COLOR_RED) | A_BOLD, 205*c76f0793SBaptiste Daroussin .shortkeycolor = GET_COLOR(COLOR_BLACK, COLOR_CYAN), 206*c76f0793SBaptiste Daroussin 207*c76f0793SBaptiste Daroussin .bottomtitlecolor= GET_COLOR(COLOR_BLACK, COLOR_CYAN) | A_BOLD 208*c76f0793SBaptiste Daroussin }; 209*c76f0793SBaptiste Daroussin 210*c76f0793SBaptiste Daroussin void bsddialog_set_theme(struct bsddialog_theme newtheme) 211*c76f0793SBaptiste Daroussin { 212*c76f0793SBaptiste Daroussin t.shadowcolor = newtheme.shadowcolor; 213*c76f0793SBaptiste Daroussin t.shadowrows = newtheme.shadowrows; 214*c76f0793SBaptiste Daroussin t.shadowcols = newtheme.shadowcols; 215*c76f0793SBaptiste Daroussin 216*c76f0793SBaptiste Daroussin t.backgroundcolor = newtheme.backgroundcolor; 217*c76f0793SBaptiste Daroussin t.surroundtitle = newtheme.surroundtitle; 218*c76f0793SBaptiste Daroussin t.titlecolor = newtheme.titlecolor; 219*c76f0793SBaptiste Daroussin t.lineraisecolor = newtheme.lineraisecolor; 220*c76f0793SBaptiste Daroussin t.linelowercolor = newtheme.linelowercolor; 221*c76f0793SBaptiste Daroussin t.widgetcolor = newtheme.widgetcolor; 222*c76f0793SBaptiste Daroussin 223*c76f0793SBaptiste Daroussin t.texthmargin = newtheme.texthmargin; 224*c76f0793SBaptiste Daroussin 225*c76f0793SBaptiste Daroussin t.curritemcolor = newtheme.curritemcolor; 226*c76f0793SBaptiste Daroussin t.itemcolor = newtheme.itemcolor; 227*c76f0793SBaptiste Daroussin t.currtagcolor = newtheme.currtagcolor; 228*c76f0793SBaptiste Daroussin t.tagcolor = newtheme.tagcolor; 229*c76f0793SBaptiste Daroussin t.namesepcolor = newtheme.namesepcolor; 230*c76f0793SBaptiste Daroussin t.descsepcolor = newtheme.descsepcolor; 231*c76f0793SBaptiste Daroussin 232*c76f0793SBaptiste Daroussin t.currfieldcolor = newtheme.currfieldcolor; 233*c76f0793SBaptiste Daroussin t.fieldcolor = newtheme.fieldcolor; 234*c76f0793SBaptiste Daroussin t.fieldreadonlycolor = newtheme.fieldreadonlycolor; 235*c76f0793SBaptiste Daroussin 236*c76f0793SBaptiste Daroussin t.currbarcolor = newtheme.currbarcolor; 237*c76f0793SBaptiste Daroussin t.barcolor = newtheme.barcolor; 238*c76f0793SBaptiste Daroussin 239*c76f0793SBaptiste Daroussin t.buttonspace = newtheme.buttonspace; 240*c76f0793SBaptiste Daroussin t.buttleftch = newtheme.buttleftch; 241*c76f0793SBaptiste Daroussin t.buttrightchar = newtheme.buttrightchar; 242*c76f0793SBaptiste Daroussin t.currbuttdelimcolor = newtheme.currbuttdelimcolor; 243*c76f0793SBaptiste Daroussin t.buttdelimcolor = newtheme.buttdelimcolor; 244*c76f0793SBaptiste Daroussin t.currbuttoncolor = newtheme.currbuttoncolor; 245*c76f0793SBaptiste Daroussin t.buttoncolor = newtheme.buttoncolor; 246*c76f0793SBaptiste Daroussin t.currshortkeycolor = newtheme.currshortkeycolor; 247*c76f0793SBaptiste Daroussin t.shortkeycolor = newtheme.shortkeycolor; 248*c76f0793SBaptiste Daroussin 249*c76f0793SBaptiste Daroussin t.bottomtitlecolor = newtheme.bottomtitlecolor; 250*c76f0793SBaptiste Daroussin 251*c76f0793SBaptiste Daroussin bkgd(t.backgroundcolor); 252*c76f0793SBaptiste Daroussin 253*c76f0793SBaptiste Daroussin refresh(); 254*c76f0793SBaptiste Daroussin } 255*c76f0793SBaptiste Daroussin 256*c76f0793SBaptiste Daroussin int bsddialog_set_default_theme(enum bsddialog_default_theme newtheme) 257*c76f0793SBaptiste Daroussin { 258*c76f0793SBaptiste Daroussin 259*c76f0793SBaptiste Daroussin if (newtheme == BSDDIALOG_THEME_DEFAULT) 260*c76f0793SBaptiste Daroussin bsddialog_set_theme(dialogtheme); 261*c76f0793SBaptiste Daroussin else if (newtheme == BSDDIALOG_THEME_BSDDIALOG) 262*c76f0793SBaptiste Daroussin bsddialog_set_theme(bsddialogtheme); 263*c76f0793SBaptiste Daroussin else if (newtheme == BSDDIALOG_THEME_BLACKWHITE) 264*c76f0793SBaptiste Daroussin bsddialog_set_theme(blackwhite); 265*c76f0793SBaptiste Daroussin else if (newtheme == BSDDIALOG_THEME_DIALOG) 266*c76f0793SBaptiste Daroussin bsddialog_set_theme(dialogtheme); 267*c76f0793SBaptiste Daroussin else if (newtheme == BSDDIALOG_THEME_MAGENTA) 268*c76f0793SBaptiste Daroussin bsddialog_set_theme(magentatheme); 269*c76f0793SBaptiste Daroussin else 270*c76f0793SBaptiste Daroussin RETURN_ERROR("Unknow default theme"); 271*c76f0793SBaptiste Daroussin 272*c76f0793SBaptiste Daroussin return 0; 273*c76f0793SBaptiste Daroussin } 274*c76f0793SBaptiste Daroussin 275*c76f0793SBaptiste Daroussin int 276*c76f0793SBaptiste Daroussin bsddialog_color(enum bsddialog_color background, enum bsddialog_color foreground) 277*c76f0793SBaptiste Daroussin { 278*c76f0793SBaptiste Daroussin 279*c76f0793SBaptiste Daroussin return GET_COLOR(background, foreground); 280*c76f0793SBaptiste Daroussin } 281*c76f0793SBaptiste Daroussin 282*c76f0793SBaptiste Daroussin struct bsddialog_theme bsddialog_get_theme() 283*c76f0793SBaptiste Daroussin { 284*c76f0793SBaptiste Daroussin 285*c76f0793SBaptiste Daroussin return t; 286*c76f0793SBaptiste Daroussin } 287