Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing colours in whiptail

Is there any way to change particular colour in whiptail ?

For example to mark specific text in red ?

For example :

#!/bin/bash
window=$(stty -a | tr \; \\012 |egrep 'rows|columns' | cut '-d ' -f3)
RED="red"
GREEN="green"


OPTION=$(whiptail --menu "\n\n\n\n\n\n\n\n" --title  "menu" --nocancel $window 20 \
"1" "COLOUR IS $RED" \
"2" "COLOUR IS $GREEN" 3>&1 1>&2 2>&3)

How can I colour $RED and $GREEN ?

like image 475
zlobul Avatar asked Oct 07 '17 11:10

zlobul


1 Answers

Since version 0.52.13 (released in 2011), you can use the NEWT_COLORS environment variable, e. g.:

#!/bin/bash

export NEWT_COLORS='
window=,red
border=white,red
textbox=white,red
button=black,white
'

whiptail ...

Alternatively, you can create a config file with your palette and reference it using the NEWT_COLORS_FILE variable. See this answer for more information.

The patch was originally created by the Ubuntu community but later accepted in the upstream.

like image 71
Bass Avatar answered Sep 18 '22 15:09

Bass