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

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

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

但是,我无法获得颜色。我所做的一切都不会改变终端的默认颜色。

我在启动后创建一个dialogrc 文件,并将其放入/etc 或$HOME 中。这是我的对话:

            #
            # 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 进行测试。

编辑: echo $TERM 显示 vt100,我正在使用 sh,对于 buildroot 来说是 ash,但我尝试使用 bash,问题仍然存在。

我是不是忘记了什么?

谢谢你的帮助 :)

答案1

感谢托马斯·迪基,我找到了解决方案。将 TERM 变量设置为“linux”而不是“vt100”。

此链接有助于了解有关此变量及其用途的更多信息: http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-11.html

相关内容