Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default menuconfig colors incompatible with KDE's Konsole default color scheme (IDFGH-2238) #4387

Closed
KaeLL opened this issue Nov 21, 2019 · 9 comments
Assignees

Comments

@KaeLL
Copy link
Contributor

KaeLL commented Nov 21, 2019

Almost impossible to see the footnote instructions.
lol

@github-actions github-actions bot changed the title Default menuconfig colors incompatible with KDE's Konsole default color scheme Default menuconfig colors incompatible with KDE's Konsole default color scheme (IDFGH-2238) Nov 21, 2019
@dobairoland
Copy link
Collaborator

tools/cmake/kconfig.cmake and make/project_config.mk contains MENUCONFIG_STYLE variable set to aquatic. You could try to rename aquatic to default or monochrome. You can customize it further as described here: https://github.com/espressif/esp-idf/blob/master/tools/kconfig_new/menuconfig.py#L67

Please let us know which setup works for you the best.

I plan to make this customizable.

@drtyhlpr
Copy link

Hi!,

menuconfig: some recent changes seem to cause (me) problems (on a default debian10 vm). latest git, ./install and ./export checked. a simple idf.py menuconfig crashes with:

    curses.init_pair(len(color_attribs) + 1, fg_color, bg_color)
_curses.error: init_pair() returned ERR

any ideas? thanks!

@dobairoland
Copy link
Collaborator

@drtyhlpr You have to set the TERM environment variable for your terminal. Something like xterm-256color should work.

Note: There will be a warning message about this in master soon.

@dobairoland dobairoland self-assigned this Nov 21, 2019
@drtyhlpr
Copy link

thanks for your fast solution!

@ulfalizer
Copy link

ulfalizer commented Nov 23, 2019

@drtyhlpr
What was your TERM setting when you got that error by the way?

FWIW, I recommend the default theme in a cross-platform environment, because I've made sure it's legible on Windows (though this is Konsole on a second look... hopefully it's legible there too). I know it's a bit yellow, but it seemed like the least ugly option that avoids color-clashing with just ANSI colors (try de-yellowing it and you might see what I mean). :)

@ulfalizer
Copy link

ulfalizer commented Nov 23, 2019

@dobairoland
I see what's going on now. With e.g. TERM=xterm, curses.COLORS ends up as 8, but the aquatic theme uses 9 color pairs.

Switching to the default theme would indirectly solve that, because it only uses 6 color pairs.

I wonder if I should have the color pairs wrap on gimped terminals. Might break the display in random ways depending on theme, but it might be better than crashing still. Another option might be to use monochrome on those.

Maybe aquatic could be tweaked to use less color pairs too...

@ulfalizer
Copy link

Oh, wait, I had misremembered what curses.COLORS means. The problem is actually that aquatic uses a bright white color that's not part of the 8 basic ANSI colors.

This patch fixes it, for e.g. TERM=xterm MENUCONFIG_STYLE=aquatic:

diff --git a/menuconfig.py b/menuconfig.py
index 1f2e9fa..3a56d52 100755
--- a/menuconfig.py
+++ b/menuconfig.py
@@ -318,7 +318,7 @@ _STYLES = {
     separator=fg:white,bg:cyan,bold
     help=path
     frame=fg:white,bg:cyan,bold
-    body=fg:brightwhite,bg:blue
+    body=fg:white,bg:blue
     edit=fg:black,bg:white
     """
 }

Will add some version of that upstream tomorrow.

ulfalizer added a commit to ulfalizer/Kconfiglib that referenced this issue Nov 23, 2019
The bright colors in the range 8-15 are not ANSI and are not guaranteed
to be available.

Previously, the code assumed that all named colors are always available
on color terminals, and skipped the check against curses.COLORS. This
led to this error e.g. with TERM=xterm (as opposed to xterm-256color)
and the aquatic theme, which uses 'brightwhite':

    _curses.error: init_pair() returned ERR

Fix it by checking the number returned for named colors against
curses.COLORS as well.

Came up in espressif/esp-idf#4387.
ulfalizer added a commit to ulfalizer/Kconfiglib that referenced this issue Nov 23, 2019
Not available with TERM=xterm (as opposed to xterm-256color).

Use fg:white instead of fg:brightwhite for dialog box bodies. Not a huge
difference.

Came up in espressif/esp-idf#4387.
@ulfalizer
Copy link

Fixed the code to avoid the crash @drtyhlpr saw, in ulfalizer/Kconfiglib@7a98bc7.

Also changed the aquatic theme to not include 'brightwhite', in ulfalizer/Kconfiglib@1ad02f5.

Re. the original issue, check if the default theme might be a better default than aquatic. I'm happy to take in any theme tweaks upstream too.

espressif-bot pushed a commit that referenced this issue Dec 16, 2019
Thank you @ulfalizer for fixing the aquatic color theme in upstream
kconfiglib.

Now "xterm" or "screen" values of TERM environment variable is
sufficient to use our default blue menuconfig. "xterm-256color" or
"screen-256color" was necessary before this fix.

See #4387 (comment)
@ulfalizer
Copy link

FYI, I just updated the aquatic theme to avoid cyan-on-blue for the path row and help text (and removed bold text, because it looks a bit cleaner IMO). It's white-on-blue now instead.

espressif-bot pushed a commit to espressif/esp-idf-kconfig that referenced this issue Oct 24, 2022
Thank you @ulfalizer for fixing the aquatic color theme in upstream
kconfiglib.

Now "xterm" or "screen" values of TERM environment variable is
sufficient to use our default blue menuconfig. "xterm-256color" or
"screen-256color" was necessary before this fix.

See espressif/esp-idf#4387 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants