0

I am using the dialog tool (based on ncurses) to create small windows for a limited UI.

However, I can't get colors. Whate ever I do doesn't change the default colors of the terminal.

I create after boot a dialogrc file that I put in /etc or in $HOME. Here is my 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

Then, I try this script, just to test my setup:

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

I expect to get a window with at least some colors in the words but I only get the black text. Howver, the text is bold.

I am using buildroot (so I compiled dialog and added the --use-ncurse-colrs option) and I am testing with QEMU.

EDIT: echo $TERM shows vt100, and I am using sh which for buildroot is ash, but I tried with bash and the problem persists.

Did I forgot something ?

Thanks for any help :)

2
  • Given a terminal (and matching description) that does color, the text is colored. You didn't mention what TERM (terminal description) and actual terminal which is used. Apr 12, 2018 at 0:13
  • Thank you for your answer :) I edited my question with more info.
    – moria
    Apr 12, 2018 at 5:51

1 Answer 1

1

Thanks to Thomas Dickey, I found the solution. Setting the TERM variable to "linux" instead of "vt100".

This link, helped understand more abou this variable and what it does: http://tldp.org/HOWTO/Keyboard-and-Console-HOWTO-11.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.