我正在编写一个供个人使用的 bash 脚本,它使用对话。我的脚本是:
#!/bin/bash
DIALOG=${DIALOG=dialog}
$DIALOG --title "Title" --clear \
--msgbox "hello world" 18 64
clear
运行脚本会产生如下菜单:
我想改变选项的OK
突出显示方式。理想情况下,我希望整个OK
“按钮”轮廓或文本在被选中时改变颜色,但我愿意让突出显示的O
颜色不同。设置由.dialogrc
下面给出的文件控制。
#
# Run-time configuration file for dialog
#
# Automatically generated by "dialog --create-rc <file>"
#
#
# Types of values:
#
# Number - <number>
# String - "string"
# Boolean - <ON|OFF>
# Attribute - (foreground,background,highlight?)
# Set aspect-ration.
aspect = 0
# Set separator (for multiple widgets output).
separate_widget = ""
# Set tab-length (for textbox tab-conversion).
tab_len = 0
# Make tab-traversal for checklist, etc., include the list.
visit_items = OFF
# Shadow dialog boxes? This also turns on color.
use_shadow = OFF
# Turn color support ON or OFF
use_colors = OFF
# Screen color
screen_color = (CYAN,BLUE,ON)
# Shadow color
shadow_color = (BLACK,BLACK,ON)
# Dialog box color
dialog_color = (BLACK,WHITE,OFF)
# Dialog box title color
title_color = (BLUE,WHITE,ON)
# Dialog box border color
border_color = (WHITE,WHITE,ON)
# Active button color
button_active_color = (WHITE,BLUE,ON)
# Inactive button color
button_inactive_color = dialog_color
# Active button key color
button_key_active_color = button_active_color
# Inactive button key color
button_key_inactive_color = (RED,WHITE,OFF)
# Active button label color
button_label_active_color = (YELLOW,BLUE,ON)
# Inactive button label color
button_label_inactive_color = (BLACK,WHITE,ON)
# Input box color
inputbox_color = dialog_color
# Input box border color
inputbox_border_color = dialog_color
# Search box color
searchbox_color = dialog_color
# Search box title color
searchbox_title_color = title_color
# Search box border color
searchbox_border_color = border_color
# File position indicator color
position_indicator_color = title_color
# Menu box color
menubox_color = dialog_color
# Menu box border color
menubox_border_color = border_color
# Item color
item_color = dialog_color
# Selected item color
item_selected_color = button_active_color
# Tag color
tag_color = title_color
# Selected tag color
tag_selected_color = button_label_active_color
# Tag key color
tag_key_color = button_key_inactive_color
# Selected tag key color
tag_key_selected_color = (RED,BLUE,ON)
# Check box color
check_color = dialog_color
# Selected check box color
check_selected_color = button_active_color
# Up arrow color
uarrow_color = (GREEN,WHITE,ON)
# Down arrow color
darrow_color = uarrow_color
# Item help-text color
itemhelp_color = (WHITE,BLACK,OFF)
# Active form text color
form_active_text_color = button_active_color
# Form text color
form_text_color = (WHITE,CYAN,ON)
# Readonly form item color
form_item_readonly_color = (CYAN,WHITE,ON)
# Dialog box gauge color
gauge_color = title_color
# Dialog box border2 color
border2_color = dialog_color
# Input box border2 color
inputbox_border2_color = dialog_color
# Search box border2 color
searchbox_border2_color = dialog_color
# Menu box border2 color
menubox_border2_color = dialog_color
是否可以编辑此文件以获得我想要的结果?我尝试更改一些设置,但我尝试的所有操作要么没有变化,要么导致错误。
我正在使用 crouton 在 chromebook 上运行 Ubuntu 14.04。
答案1
屏幕截图中突出显示的“O”是终端光标。您无法控制其外观,它会根据每个用户的终端设置进行呈现。
例如,它在 OS X 终端中以默认光标样式(“块光标”)显示的样子如下:
这是将光标样式改为“垂直条”后的样子:
这是在tput civis
对话框命令之前运行使光标不可见的样子(并tput cnorm
在对话框运行后使其再次可见):
答案2
不是一个答案,但你可能对对话替代方案更感兴趣 - whiptail
至于你的 dialogocrc 文件,这一行button_label_active_color = (YELLOW,BLUE,ON)
可能是你想要的