Skip to content

Instantly share code, notes, and snippets.

@neverkas
Last active April 26, 2023 19:56
Show Gist options
  • Save neverkas/81f241c6f73cb27a5774d04641151d5c to your computer and use it in GitHub Desktop.
Save neverkas/81f241c6f73cb27a5774d04641151d5c to your computer and use it in GitHub Desktop.
Whiptail dialog box colored on Makefile + Bash Shell

Whiptail dialog box colored

The structure

The structure of the definitions is name=[fg],[bg][;|:|\n|\r|\t]name2=[fg],[bg]]...

name can be

root                  root fg, bg
border                border fg, bg
window                window fg, bg
shadow                shadow fg, bg
title                 title fg, bg
button                button fg, bg
actbutton             active button fg, bg
checkbox              checkbox fg, bg
actcheckbox           active checkbox fg, bg
entry                 entry box fg, bg
label                 label fg, bg
listbox               listbox fg, bg
actlistbox            active listbox fg, bg
textbox               textbox fg, bg
acttextbox            active textbox fg, bg
helpline              help line
roottext              root text
emptyscale            scale full
fullscale             scale empty
disentry              disabled entry fg, bg
compactbutton         compact button fg, bg
actsellistbox         active & sel listbox
sellistbox            selected listbox

bg and fg can be

color0  or black
color1  or red
color2  or green
color3  or brown
color4  or blue
color5  or magenta
color6  or cyan
color7  or lightgray
color8  or gray
color9  or brightred
color10 or brightgreen
color11 or yellow
color12 or brightblue
color13 or brightmagenta
color14 or brightcyan
color15 or white

References

NEWT_COLOR_PALETTE_DIALOGS="$(shell cat configs/whiptail-theme-green.cfg)"
# remember that GNU Make will create a new subshell if we don't use ; character
# (some like this could happen if we forget to use \ character when we've multiple lines)
WHIPTAIL_COLORED=export NEWT_COLORS=$(NEWT_COLOR_PALETTE_DIALOGS); whiptail
box-alert:
$(WHIPTAIL_COLORED) \
--title "Alert" \
--msgbox "something to describe here" 10 50 \
2>&1 1>/dev/tty
root=green,black
border=green,black
title=green,black
roottext=white,black
window=green,black
textbox=white,black
button=black,green
compactbutton=white,black
listbox=white,black
actlistbox=black,white
actsellistbox=black,green
checkbox=green,black
actcheckbox=black,green
root=green,black
border=green,black
title=green,black
roottext=white,black
window=green,black
textbox=white,black
button=black,green
compactbutton=white,black
listbox=white,black
actlistbox=black,white
actsellistbox=black,green
checkbox=green,black
actcheckbox=black,green
@neverkas
Copy link
Author

neverkas commented Apr 26, 2023

here's some pictures as example

whiptail-colored

whiptail2

whiptail3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment