改变鞭尾的颜色

时间:2017-10-07 11:17:09

标签: linux bash colors whiptail

有没有办法改变鞭尾的特定颜色?

例如,将特定文字标记为红色?

例如:

#!/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)

如何为$ RED和$ GREEN上色?

2 个答案:

答案 0 :(得分:3)

从版本0.52。13(2011年发布)开始,您可以使用NEWT_COLORS环境变量,例如: G:

#!/bin/bash

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

whiptail ...

或者,您可以使用调色板创建配置文件,并使用NEWT_COLORS_FILE变量引用它。有关详细信息,请参阅this answer

该补丁最初由 Ubuntu 社区创建,但后来在上游创建accepted

答案 1 :(得分:2)

whiptail没有相关的命令选项或配置文件来更改其配色方案。您可以通过阅读其源代码来了解做什么

dialog确实具备此功能(请参阅screenshots)。

相关问题