dialogrc文件不会更改菜单框和文本的颜色

时间:2018-04-11 13:09:52

标签: shell colors character-encoding dialog

我正在使用对话框工具(基于ncurses)为有限的UI创建小窗口。

然而,我无法获得颜色。我做过的事情并没有改变终端的默认颜色。

我在启动后创建一个dialogrc文件,我放在/ etc或$ HOME中。这是我的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 = ON

            # Turn color support ON or OFF
            use_colors = ON

            # Screen color
            screen_color = (RED,BLACK,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

然后,我尝试这个脚本,只是为了测试我的设置:

#!/bin/sh
dialog --colors --title 'Message' --msgbox "\Zb\Z3HELLO\Z2 WORLD" 5 20

我期望得到一个至少有一些颜色的窗口,但我只得到黑色文字。但是,文字是粗体。

我正在使用buildroot(所以我编译了对话框并添加了--use-ncurse-colrs选项),我正在使用QEMU进行测试。

我忘记了什么吗?

感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

感谢您的回答,它帮助我找到了解决方案。将TERM变量设置为&#34; linux&#34;而不是&#34; vt100&#34;。

此链接有助于更好地了解此变量及其作用:http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-11.html