Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

htop "Display options -> shadow other users' processes" returns black on black for TERM=linux-16color on a Linux console (tty) #630

Closed
fasterit opened this issue May 21, 2017 · 5 comments

Comments

@fasterit
Copy link
Collaborator

Debian bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793106

Reproducible by:

  1. switch to a Linux console (virtual terminal, e.g. ALT-CTRL F1)
  2. log in
  3. run TERM=linux-16color htop
  4. enable "Setup -> Display options -> shadow other users' processes"
  5. you see other users' processes black on black unless highlighted

Can this be fixed in the curses magic htop uses or via a work-around or (least desirably) mentioned in the documentation?

@hishamhm
Copy link
Owner

hishamhm commented May 23, 2017

Please run this test program:

/* color.c */
#include <curses.h>

int main(void) {
    initscr();
    start_color();
    //init_color(8, 500, 500, 500); /* disabled line */

    printw("Can change colors? %c\n", can_change_color() ? 'Y' : 'N');
    for (int i = 0; i <= 15; i++) {
        init_pair(i+2, i, 0);
        attron(COLOR_PAIR(i+2));
        printw("Color %d!\n", i);
        attron(A_BOLD);
        printw("Bold color %d %d!\n", i, COLOR_PAIRS);
        attroff(A_BOLD);
    }
    refresh();

    getch();

    endwin();
}

Compile it with gcc -o color color.c -lncursesw

and run it with and without TERM=linux-16color.

Which colors, if any, appear as dark gray (and in which mode)? Sending images of your results would also be helpful. (If taking a screenshot from the console is problematic, you can take pictures from your phone :) )

If color 8 appears as cyan when running with TERM=linux-16color, try removing the // from the line marked disabled line and recompiling, and let me know if it makes any difference.

I got some weird results in my machine (which would require some ugly workarounds in htop), and I'd like to see if the results are at least consistent across machines/distros.

@fasterit
Copy link
Collaborator Author

fasterit commented May 23, 2017

fbcat makes nice screenshots from the framebuffer linux consoles.
I did not comment in your line as per instructions. I hope I understood these correctly.
Kind regards,
Daniel

TERM=linux
linux

TERM=linux-16color
linux-16color

@hishamhm
Copy link
Owner

Got it, thanks!

Interesting results! They look different than what I got in my system, but they look compatible to the tweak I implemented.

Please try this branch, fixedgray:

git clone --branch fixedgray https://github.com/hishamhm/htop
cd htop
./autogen.sh
./configure
make
./htop

Hopefully it fixes the behavior of gray. It may even obsolete the "Broken Gray" mode!

@fasterit
Copy link
Collaborator Author

Yes, that works much better. Gray text (like the "other users' processes" but also in the header section on the gauges) is now readable very well under TERM=linux-16color.
Confirmed working for Linux console (tty), gnome-terminal and xcfe4-terminal.
Thank you!
/DLange

@hishamhm
Copy link
Owner

hishamhm commented Jun 6, 2017

@fasterit Excellent, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants